DATE_TRUNC
Truncate a date to a given time unit.
Syntax
Arguments
Returns
timestamp
Examples
Transformation job example
SQL
Query result
Last updated
Name | Type | Description | Default Value |
---|---|---|---|
unit | time | Output |
---|---|---|
unit | time | Output |
---|---|---|
unit
string
time
timestamp
'millisecond'
timestamp '2021-02-03 04:05:06.789'
timestamp '2021-02-03 04:05:06.789'
'second'
timestamp '2021-02-03 04:05:06.789'
timestamp '2021-02-03 04:05:06'
'minute'
timestamp '2021-02-03 04:05:06.789'
timestamp '2021-02-03 04:05:00'
'hour'
timestamp '2021-02-03 04:05:06.789'
timestamp '2021-02-03 04:00:00'
'day'
timestamp '2021-02-03 04:05:06.789'
timestamp '2021-02-03 00:00:00'
'week'
timestamp '2021-02-03 04:05:06.789'
timestamp '2021-02-01 00:00:00'
'month'
timestamp '2021-02-03 04:05:06.789'
timestamp '2021-02-01 00:00:00'
'quarter'
timestamp '2021-02-03 04:05:06.789'
timestamp '2021-01-01 00:00:00'
'year'
timestamp '2021-02-03 04:05:06.789'
timestamp '2021-01-01 00:00:00'
'millisecond'
timestamp '2021-12-31 23:59:59.999'
timestamp '2021-12-31 23:59:59.999'
'second'
timestamp '2021-12-31 23:59:59.999'
timestamp '2021-12-31 23:59:59'
'minute'
timestamp '2021-12-31 23:59:59.999'
timestamp '2021-12-31 23:59:00'
'hour'
timestamp '2021-12-31 23:59:59.999'
timestamp '2021-12-31 23:00:00'
'day'
timestamp '2021-12-31 23:59:59.999'
timestamp '2021-12-31 00:00:00'
'week'
timestamp '2021-12-31 23:59:59.999'
timestamp '2021-12-27 00:00:00'
'month'
timestamp '2021-12-31 23:59:59.999'
timestamp '2021-12-01 00:00:00'
'quarter'
timestamp '2021-12-31 23:59:59.999'
timestamp '2021-10-01 00:00:00'
'year'
timestamp '2021-12-31 23:59:59.999'
timestamp '2021-01-01 00:00:00'
'test'
timestamp '2021-12-31 23:59:59.999'
null
'millisecond'
timestamp '2021-02-03 04:05:06.789'
timestamp '2021-02-03 04:05:06.789'