Creates a TIME value from components, or extracts the TIME portion from a timestamp or datetime.
TIMEDiperbarui: 13 Jun 2026TIME(hour, minute, second) | TIME(timestamp [, time_zone]) | TIME(datetime)Hour (0-23)
Minute (0-59)
Second (0-59)
Timestamp to extract from
Datetime to extract from
Timezone for conversion
1 SELECT 2 TIME(14, 30, 0) as afternoon, 3 TIME(9, 0, 0) as morning, 4 TIME(23, 59, 59) as late_night;
Create a TIME value from hour, minute, and second components.
| afternoon | morning | late_night |
|---|---|---|
| 14:30:00 | 09:00:00 | 23:59:59 |
1 SELECT 2 ts, 3 TIME(ts, 'Asia/Jakarta') as jakarta_time 4 FROM UNNEST([TIMESTAMP '2024-01-15 10:30:00 UTC']) as ts;
Extract the TIME portion from a timestamp using a specified timezone.
| ts | jakarta_time |
|---|---|
| 2024-01-15 10:30:00 UTC | 17:30:00 |
1 SELECT 2 order_id, 3 TIME(order_timestamp, 'Asia/Jakarta') as order_time, 4 CASE 5 WHEN TIME(order_timestamp, 'Asia/Jakarta') < TIME(9, 0, 0) THEN 'Before Hours' 6 WHEN TIME(order_timestamp, 'Asia/Jakarta') < TIME(17, 0, 0) THEN 'Business Hours' 7 ELSE 'After Hours' 8 END as time_category 9 FROM `project.dataset.orders`;
Categorize orders based on the time of day they were placed.
Sudah paham TIME? Latih langsung di browser
Latihan interaktif, langsung di browser.