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
Copy file name to clipboardExpand all lines: ydb/docs/en/core/yql/reference/yql-core/udf/list/datetime.md
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -181,21 +181,28 @@ SELECT
181
181
DateTime::ToDays(cast('2018-01-01' as date) - cast('2017-12-31' as date)); --1
182
182
```
183
183
184
-
## StartOf... / TimeOfDay {#startof}
184
+
## StartOf... / EndOf... / TimeOfDay {#startof}
185
185
186
-
Get the start of the period including the date/time. If the result is invalid, NULL is returned. If the timezone is different from GMT, then the period start is in the specified time zone.
186
+
Get the start (end) of the period including the date/time. If the result is invalid, NULL is returned. If the timezone is different from GMT, then the period start (end) is in the specified time zone.
The `StartOf` function is intended for grouping by an arbitrary period within a day. The result differs from the input value only by time components. A period exceeding one day is treated as a day (an equivalent of `StartOfDay`). If a day doesn't include an integer number of periods, the number is rounded to the nearest time from the beginning of the day that is a multiple of the specified period. When the interval is zero, the output is same as the input. A negative interval is treated as a positive one.
198
203
204
+
The `EndOf...` functions are intended for obtaining the latest moment in the same period of time as the specified one.
205
+
199
206
The functions treat periods longer than one day in a different manner than the same-name functions in the old library. The time components are always reset to zero (this makes sense, because these functions are mainly used for grouping by the period). You can also specify a time period within a day:
Copy file name to clipboardExpand all lines: ydb/docs/ru/core/yql/reference/yql-core/udf/list/datetime.md
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -187,21 +187,28 @@ SELECT
187
187
DateTime::ToDays(cast('2018-01-01' as date) - cast('2017-12-31' as date)); --1
188
188
```
189
189
190
-
## StartOf... / TimeOfDay {#startof}
190
+
## StartOf... / EndOf... / TimeOfDay {#startof}
191
191
192
-
Получить начало периода, содержащего дату/время. При некорректном результате возвращается NULL. Если таймзона не GMT, то начало периода будет в указанной временной зоне.
192
+
Получить начало (конец) периода, содержащего дату/время. При некорректном результате возвращается NULL. Если таймзона не GMT, то начало (конец) периода будет в указанной временной зоне.
Функция `StartOf` предназначена для группировки в пределах суток по произвольному периоду. Результат отличается от входного значения только компонентами времени. Период более суток трактуется как сутки (эквивалентно `StartOfDay`). Если в сутках не содержится целого числа периодов, производится округление к ближайшему времени от начала суток, кратному указанному периоду. При нулевом интервале выход совпадает со входом. Отрицательный интервал трактуется как положительный.
204
209
210
+
Функции `EndOf...` предназначены для получения последнего момента времени, находящегося в том же выбранном интервале, что и заданный.
211
+
205
212
Поведение функций с периодами больше дня отличается от поведения одноимённых функций в старой библиотеке. Компоненты времени всегда обнуляются (это логично, поскольку эти функции в основном используются для группировки по периоду). Отдельно существует возможность выделить время в пределах суток:
0 commit comments