You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# combine `to_local_time()` with `date_bin()` to bin on boundaries in the timezone rather
1820
+
# than UTC boundaries
1821
+
1822
+
> SELECT date_bin(interval '1 day', to_local_time('2024-04-01T00:00:20Z'::timestamp AT TIME ZONE 'Europe/Brussels')) AS date_bin;
1823
+
+---------------------+
1824
+
| date_bin |
1825
+
+---------------------+
1826
+
| 2024-04-01T00:00:00 |
1827
+
+---------------------+
1828
+
1829
+
> SELECT date_bin(interval '1 day', to_local_time('2024-04-01T00:00:20Z'::timestamp AT TIME ZONE 'Europe/Brussels')) AT TIME ZONE 'Europe/Brussels' AS date_bin_with_timezone;
1830
+
+---------------------------+
1831
+
| date_bin_with_timezone |
1832
+
+---------------------------+
1833
+
| 2024-04-01T00:00:00+02:00 |
1834
+
+---------------------------+
1835
+
```
1836
+
1774
1837
### `to_timestamp`
1775
1838
1776
1839
Converts a value to a timestamp (`YYYY-MM-DDT00:00:00Z`).
0 commit comments