From 78d77273c5a33d1240830be27f3ff31fc1f8e64c Mon Sep 17 00:00:00 2001 From: Vladimir Chebotarev Date: Wed, 15 Jun 2016 03:29:45 +0300 Subject: [PATCH] doc: Small addition. [#METR-21516] --- doc/reference_en.html | 6 ++++++ doc/reference_ru.html | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/doc/reference_en.html b/doc/reference_en.html index 3c4b0af67cf..a99dfc37558 100644 --- a/doc/reference_en.html +++ b/doc/reference_en.html @@ -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. diff --git a/doc/reference_ru.html b/doc/reference_ru.html index fffc9bc51a7..1464f042a2a 100644 --- a/doc/reference_ru.html +++ b/doc/reference_ru.html @@ -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)) Преобразование между датой и датой-с-временем производится естественным образом: добавлением нулевого времени или отбрасыванием времени.