date_trunc
A Date or timestamp truncated to option unit: year, quarter, month, week (ISO, Monday), day, hour, minute or second; a Timestamp in UTC.
Flags
| Flag | Value |
|---|---|
| Kind | scalar |
| Nulls | a null argument gives null |
| Deterministic | yes |
| Order matters | no |
| Decomposable | no |
Example
A pipeline from the language's tested corpus that uses date_trunc, over the example tables.
from orders
derive {h = hour(placed), mi = minute(placed), s = second(placed), wk = date_trunc(placed, unit: "week")}In a plan:
{
"args": [
{
"col": 6
}
],
"fn": "date_trunc",
"options": {
"unit": "week"
}
}