mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Merge branch 'master' of github.yandex-team.ru:Metrika/ClickHouse
This commit is contained in:
commit
718bf3d9ab
@ -4228,6 +4228,12 @@ When converting to or from a string, the value is formatted or parsed using the
|
||||
When converting dates to numbers or vice versa, the date corresponds to the number of days since the beginning of the Unix epoch.
|
||||
When converting dates with times to numbers or vice versa, the date with time corresponds to the number of seconds since the beginning of the Unix epoch.
|
||||
|
||||
Formats of date and date with time for toDate/toDateTime functions are defined as follows:
|
||||
%%
|
||||
YYYY-MM-DD
|
||||
YYYY-MM-DD hh:mm:ss
|
||||
%%
|
||||
|
||||
As an exception, if converting from UInt32, Int32, UInt64, or Int64 type numbers to Date, and if the number is greater than or equal to 65536, the number is interpreted as a Unix timestamp (and not as the number of days) and is rounded to the date. This allows support for the common occurrence of writing 'toDate(unix_timestamp)', which otherwise would be an error and would require writing the more cumbersome 'toDate(toDateTime(unix_timestamp))'.
|
||||
|
||||
Conversion between a date and date with time is performed the natural way: by adding a null time or dropping the time.
|
||||
|
@ -4515,6 +4515,12 @@ LIMIT 10
|
||||
При преобразовании даты в число или наоборот, дате соответствует число дней от начала unix эпохи.
|
||||
При преобразовании даты-с-временем в число или наоборот, дате-с-временем соответствует число секунд от начала unix эпохи.
|
||||
|
||||
Форматы даты и даты-с-временем для функций toDate/toDateTime определены следующим образом:
|
||||
%%
|
||||
YYYY-MM-DD
|
||||
YYYY-MM-DD hh:mm:ss
|
||||
%%
|
||||
|
||||
В качестве исключения, если делается преобразование из числа типа UInt32, Int32, UInt64, Int64 в Date, и если число больше или равно 65536, то число рассматривается как unix timestamp (а не как число дней) и округляется до даты. Это позволяет поддержать распространённый случай, когда пишут toDate(unix_timestamp), что иначе было бы ошибкой и требовало бы написания более громоздкого toDate(toDateTime(unix_timestamp))
|
||||
|
||||
Преобразование между датой и датой-с-временем производится естественным образом: добавлением нулевого времени или отбрасыванием времени.
|
||||
|
Loading…
Reference in New Issue
Block a user