Split a timestamp into its date and hour (door access)
Each event has a text timestamp like 2026-03-04T14:30:00. Add a real Date and the Hour of day.
- Level
- intermediate
- Time
- ~7 min
- Task
- Build the query
- Access
- Free — no account needed
Loading the practice workspace…
About this exercise
What you'll practise
Convert text to datetime, then take its date part and hour.
Quillstack (fictional) analyses badge swipes at its office doors to plan cleaning shifts.
Steps
Timestampis text in ISO format (yyyy-mm-ddThh:mm:ss).- Add
Date(a date, not text) andHour(a whole number 0–23) from it. - Output
EventID,Date,Hour.
Your result must
- Date is a date value
- Hour is 0–23
- Three columns
Input
- Events (table)
- EventID: text
- Timestamp: text
Expected output columns
EventID (text), Date (date), Hour (number)
| EventID | Date | Hour |
|---|---|---|
| D1 | 2026-02-20 | 18 |
| D2 | 2026-02-02 | 0 |
| D3 | 2026-02-10 | 0 |