mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Docs: toStartOfInterval uses uppercase units
For consistency with existing documentation https://clickhouse.com/docs/en/sql-reference/data-types/special-data-types/interval ... and with MySQL
This commit is contained in:
parent
33a0e8035f
commit
1dff80374c
@ -1417,31 +1417,31 @@ toStartOfFifteenMinutes(toDateTime('2023-04-21 10:23:00')): 2023-04-21 10:15:00
|
|||||||
|
|
||||||
This function generalizes other `toStartOf*()` functions with `toStartOfInterval(date_or_date_with_time, INTERVAL x unit [, time_zone])` syntax.
|
This function generalizes other `toStartOf*()` functions with `toStartOfInterval(date_or_date_with_time, INTERVAL x unit [, time_zone])` syntax.
|
||||||
For example,
|
For example,
|
||||||
- `toStartOfInterval(t, INTERVAL 1 year)` returns the same as `toStartOfYear(t)`,
|
- `toStartOfInterval(t, INTERVAL 1 YEAR)` returns the same as `toStartOfYear(t)`,
|
||||||
- `toStartOfInterval(t, INTERVAL 1 month)` returns the same as `toStartOfMonth(t)`,
|
- `toStartOfInterval(t, INTERVAL 1 MONTH)` returns the same as `toStartOfMonth(t)`,
|
||||||
- `toStartOfInterval(t, INTERVAL 1 day)` returns the same as `toStartOfDay(t)`,
|
- `toStartOfInterval(t, INTERVAL 1 DAY)` returns the same as `toStartOfDay(t)`,
|
||||||
- `toStartOfInterval(t, INTERVAL 15 minute)` returns the same as `toStartOfFifteenMinutes(t)`.
|
- `toStartOfInterval(t, INTERVAL 15 MINUTE)` returns the same as `toStartOfFifteenMinutes(t)`.
|
||||||
|
|
||||||
The calculation is performed relative to specific points in time:
|
The calculation is performed relative to specific points in time:
|
||||||
|
|
||||||
| Interval | Start |
|
| Interval | Start |
|
||||||
|-------------|------------------------|
|
|-------------|------------------------|
|
||||||
| year | year 0 |
|
| YEAR | year 0 |
|
||||||
| quarter | 1900 Q1 |
|
| QUARTER | 1900 Q1 |
|
||||||
| month | 1900 January |
|
| MONTH | 1900 January |
|
||||||
| week | 1970, 1st week (01-05) |
|
| WEEK | 1970, 1st week (01-05) |
|
||||||
| day | 1970-01-01 |
|
| DAY | 1970-01-01 |
|
||||||
| hour | (*) |
|
| HOUR | (*) |
|
||||||
| minute | 1970-01-01 00:00:00 |
|
| MINUTE | 1970-01-01 00:00:00 |
|
||||||
| second | 1970-01-01 00:00:00 |
|
| SECOND | 1970-01-01 00:00:00 |
|
||||||
| millisecond | 1970-01-01 00:00:00 |
|
| MILLISECOND | 1970-01-01 00:00:00 |
|
||||||
| microsecond | 1970-01-01 00:00:00 |
|
| MICROSECOND | 1970-01-01 00:00:00 |
|
||||||
| nanosecond | 1970-01-01 00:00:00 |
|
| NANOSECOND | 1970-01-01 00:00:00 |
|
||||||
|
|
||||||
(*) hour intervals are special: the calculation is always performed relative to 00:00:00 (midnight) of the current day. As a result, only
|
(*) hour intervals are special: the calculation is always performed relative to 00:00:00 (midnight) of the current day. As a result, only
|
||||||
hour values between 1 and 23 are useful.
|
hour values between 1 and 23 are useful.
|
||||||
|
|
||||||
If unit `week` was specified, `toStartOfInterval` assumes that weeks start on Monday. Note that this behavior is different from that of function `toStartOfWeek` in which weeks start by default on Sunday.
|
If unit `WEEK` was specified, `toStartOfInterval` assumes that weeks start on Monday. Note that this behavior is different from that of function `toStartOfWeek` in which weeks start by default on Sunday.
|
||||||
|
|
||||||
**See Also**
|
**See Also**
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user