提交 56b401cf 编写于 作者: V Vitaly Baranov

Add documentation for new datetime functions toStartOfInterval()

and toStartOfTenMinutes().
上级 23d70b2e
......@@ -66,9 +66,9 @@ Leap seconds are not accounted for.
Converts a date with time to a unix timestamp.
## toMonday
## toStartOfYear
Rounds down a date or date with time to the nearest Monday.
Rounds down a date or date with time to the first day of the year.
Returns the date.
## toStartOfISOYear
......@@ -76,6 +76,12 @@ Returns the date.
Rounds down a date or date with time to the first day of ISO year.
Returns the date.
## toStartOfQuarter
Rounds down a date or date with time to the first day of the quarter.
The first day of the quarter is either 1 January, 1 April, 1 July, or 1 October.
Returns the date.
## toStartOfMonth
Rounds down a date or date with time to the first day of the month.
......@@ -84,16 +90,18 @@ Returns the date.
!!! attention
The behavior of parsing incorrect dates is implementation specific. ClickHouse may return zero date, throw an exception or do "natural" overflow.
## toStartOfQuarter
## toMonday
Rounds down a date or date with time to the first day of the quarter.
The first day of the quarter is either 1 January, 1 April, 1 July, or 1 October.
Rounds down a date or date with time to the nearest Monday.
Returns the date.
## toStartOfYear
## toStartOfDay
Rounds down a date or date with time to the first day of the year.
Returns the date.
Rounds down a date with time to the start of the day.
## toStartOfHour
Rounds down a date with time to the start of the hour.
## toStartOfMinute
......@@ -103,19 +111,19 @@ Rounds down a date with time to the start of the minute.
Rounds down a date with time to the start of the five-minute interval.
## toStartOfTenMinutes
Rounds down a date with time to the start of the ten-minute interval.
## toStartOfFifteenMinutes
Rounds down the date with time to the start of the fifteen-minute interval.
Note: If you need to round a date with time to any other number of seconds, minutes, or hours, you can convert it into a number by using the toUInt32 function, then round the number using intDiv and multiplication, and convert it back using the toDateTime function.
## toStartOfHour
Rounds down a date with time to the start of the hour.
## toStartOfDay
Rounds down a date with time to the start of the day.
## toStartOfInterval(time_or_data, INTERVAL x unit [, time_zone])
This is a generalization of other functions named `toStartOf*`. For example,
`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 day)` returns the same as `toStartOfDay(t)`,
`toStartOfInterval(t, INTERVAL 15 minute)` returns the same as `toStartOfFifteenMinutes(t)` etc.
## toTime
......
......@@ -43,8 +43,13 @@ SELECT
Переводит дату-с-временем в число типа UInt8, содержащее номер секунды в минуте (0-59).
Секунды координации не учитываются.
## toMonday
Округляет дату или дату-с-временем вниз до ближайшего понедельника.
## toStartOfYear
Округляет дату или дату-с-временем вниз до первого дня года.
Возвращается дата.
## toStartOfQuarter
Округляет дату или дату-с-временем вниз до первого дня квартала.
Первый день квартала - это одно из 1 января, 1 апреля, 1 июля, 1 октября.
Возвращается дата.
## toStartOfMonth
......@@ -54,14 +59,15 @@ SELECT
!!! attention
Возвращаемое значение для некорректных дат зависит от реализации. ClickHouse может вернуть нулевую дату, выбросить исключение, или выполнить "естественное" перетекание дат между месяцами.
## toStartOfQuarter
Округляет дату или дату-с-временем вниз до первого дня квартала.
Первый день квартала - это одно из 1 января, 1 апреля, 1 июля, 1 октября.
## toMonday
Округляет дату или дату-с-временем вниз до ближайшего понедельника.
Возвращается дата.
## toStartOfYear
Округляет дату или дату-с-временем вниз до первого дня года.
Возвращается дата.
## toStartOfDay
Округляет дату-с-временем вниз до начала дня. Возвращается дата-с-временем.
## toStartOfHour
Округляет дату-с-временем вниз до начала часа.
## toStartOfMinute
Округляет дату-с-временем вниз до начала минуты.
......@@ -69,16 +75,18 @@ SELECT
## toStartOfFiveMinute
Округляет дату-с-временем вниз до начала пятиминутного интервала.
## toStartOfTenMinutes
Округляет дату-с-временем вниз до начала десятиминутного интервала.
## toStartOfFifteenMinutes
Округляет дату-с-временем вниз до начала пятнадцатиминутного интервала.
Замечание: если вам нужно округлить дату-с-временем до какого-либо другого количества секунд, минут или часов, вы можете перевести её в число с помощью функции toUInt32, затем округлить число с помощью функции intDiv и умножения, а затем перевести обратно, с помощью функции toDateTime.
## toStartOfHour
Округляет дату-с-временем вниз до начала часа.
## toStartOfDay
Округляет дату-с-временем вниз до начала дня.
## toStartOfInterval(time_or_data, INTERVAL x unit [, time_zone])
Обобщение остальных функций `toStartOf*`. Например,
`toStartOfInterval(t, INTERVAL 1 year)` возвращает то же самое, что и `toStartOfYear(t)`,
`toStartOfInterval(t, INTERVAL 1 month)` возвращает то же самое, что и `toStartOfMonth(t)`,
`toStartOfInterval(t, INTERVAL 1 day)` возвращает то же самое, что и `toStartOfDay(t)`,
`toStartOfInterval(t, INTERVAL 15 minute)` возвращает то же самое, что и `toStartOfFifteenMinutes(t)`, и т.п.
## toTime
Переводит дату-с-временем на некоторую фиксированную дату, сохраняя при этом время.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册