2020-06-20 11:29:01 +00:00
|
|
|
SET send_logs_level = 'fatal';
|
2018-09-18 18:31:43 +00:00
|
|
|
|
2018-09-17 17:02:12 +00:00
|
|
|
SELECT formatDateTime(); -- { serverError 42 }
|
|
|
|
SELECT formatDateTime('not a datetime', 'IGNORED'); -- { serverError 43 }
|
|
|
|
SELECT formatDateTime(now(), now()); -- { serverError 43 }
|
|
|
|
SELECT formatDateTime(now(), 'good format pattern', now()); -- { serverError 43 }
|
|
|
|
SELECT formatDateTime(now(), 'unescaped %'); -- { serverError 36 }
|
2018-09-19 20:07:46 +00:00
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%U'); -- { serverError 48 }
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%W'); -- { serverError 48 }
|
2018-09-17 17:02:12 +00:00
|
|
|
|
2022-10-28 14:08:28 +00:00
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%C'), formatDateTime(toDate32('2018-01-02'), '%C');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%d'), formatDateTime(toDate32('2018-01-02'), '%d');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%D'), formatDateTime(toDate32('2018-01-02'), '%D');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%e'), formatDateTime(toDate32('2018-01-02'), '%e');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%F'), formatDateTime(toDate32('2018-01-02'), '%F');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%H'), formatDateTime(toDate32('2018-01-02'), '%H');
|
2018-09-17 17:02:12 +00:00
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 02:33:44'), '%H');
|
2022-10-28 14:08:28 +00:00
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%I'), formatDateTime(toDate32('2018-01-02'), '%I');
|
2018-09-17 17:02:12 +00:00
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 11:33:44'), '%I');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 00:33:44'), '%I');
|
2022-10-28 14:08:28 +00:00
|
|
|
SELECT formatDateTime(toDateTime('2018-01-01 00:33:44'), '%j'), formatDateTime(toDate32('2018-01-01'), '%j');
|
|
|
|
SELECT formatDateTime(toDateTime('2000-12-31 00:33:44'), '%j'), formatDateTime(toDate32('2000-12-31'), '%j');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%m'), formatDateTime(toDate32('2018-01-02'), '%m');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%M'), formatDateTime(toDate32('2018-01-02'), '%M');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%n'), formatDateTime(toDate32('2018-01-02'), '%n');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 00:33:44'), '%p'), formatDateTime(toDateTime('2018-01-02'), '%p');
|
2018-09-17 17:02:12 +00:00
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 11:33:44'), '%p');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 12:33:44'), '%p');
|
2022-10-28 14:08:28 +00:00
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%R'), formatDateTime(toDate32('2018-01-02'), '%R');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%S'), formatDateTime(toDate32('2018-01-02'), '%S');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%t'), formatDateTime(toDate32('2018-01-02'), '%t');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%T'), formatDateTime(toDate32('2018-01-02'), '%T');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-01 22:33:44'), '%u'), formatDateTime(toDateTime('2018-01-07 22:33:44'), '%u'),
|
|
|
|
formatDateTime(toDate32('2018-01-01'), '%u'), formatDateTime(toDate32('2018-01-07'), '%u');
|
2018-09-17 17:02:12 +00:00
|
|
|
SELECT formatDateTime(toDateTime('1996-01-01 22:33:44'), '%V'), formatDateTime(toDateTime('1996-12-31 22:33:44'), '%V'),
|
2022-10-28 14:08:28 +00:00
|
|
|
formatDateTime(toDateTime('1999-01-01 22:33:44'), '%V'), formatDateTime(toDateTime('1999-12-31 22:33:44'), '%V'),
|
|
|
|
formatDateTime(toDate32('1996-01-01'), '%V'), formatDateTime(toDate32('1996-12-31'), '%V'),
|
|
|
|
formatDateTime(toDate32('1999-01-01'), '%V'), formatDateTime(toDate32('1999-12-31'), '%V');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-01 22:33:44'), '%w'), formatDateTime(toDateTime('2018-01-07 22:33:44'), '%w'),
|
|
|
|
formatDateTime(toDate32('2018-01-01'), '%w'), formatDateTime(toDate32('2018-01-07'), '%w');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%y'), formatDateTime(toDate32('2018-01-02'), '%y');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%Y'), formatDateTime(toDate32('2018-01-02'), '%Y');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), '%%'), formatDateTime(toDate32('2018-01-02'), '%%');
|
|
|
|
SELECT formatDateTime(toDateTime('2018-01-02 22:33:44'), 'no formatting pattern'), formatDateTime(toDate32('2018-01-02'), 'no formatting pattern');
|
2018-09-18 00:32:24 +00:00
|
|
|
|
|
|
|
SELECT formatDateTime(toDate('2018-01-01'), '%F %T');
|
2022-10-27 10:46:41 +00:00
|
|
|
SELECT formatDateTime(toDate32('1927-01-01'), '%F %T');
|
|
|
|
|
2018-09-18 00:32:24 +00:00
|
|
|
SELECT
|
|
|
|
formatDateTime(toDateTime('2018-01-01 01:00:00', 'UTC'), '%F %T', 'UTC'),
|
2022-08-30 00:40:11 +00:00
|
|
|
formatDateTime(toDateTime('2018-01-01 01:00:00', 'UTC'), '%F %T', 'Asia/Istanbul');
|
2022-08-29 20:47:33 +00:00
|
|
|
|
2022-08-30 00:40:11 +00:00
|
|
|
SELECT formatDateTime(toDateTime('2020-01-01 01:00:00', 'UTC'), '%z');
|
|
|
|
SELECT formatDateTime(toDateTime('2020-01-01 01:00:00', 'US/Samoa'), '%z');
|
|
|
|
SELECT formatDateTime(toDateTime('2020-01-01 01:00:00', 'Europe/Moscow'), '%z');
|
2022-08-30 17:42:12 +00:00
|
|
|
SELECT formatDateTime(toDateTime('1970-01-01 00:00:00', 'Asia/Kolkata'), '%z');
|
2022-12-08 22:53:16 +00:00
|
|
|
|
|
|
|
select formatDateTime(toDateTime64('2010-01-04 12:34:56.123456', 7), '%f');
|
2022-12-08 23:14:14 +00:00
|
|
|
select formatDateTime(toDateTime64('2022-12-08 18:11:29.00034', 6, 'UTC'), '%f');
|
2022-12-21 18:57:30 +00:00
|
|
|
|
|
|
|
select formatDateTime(toDateTime64('2022-12-08 18:11:29.1234', 9, 'UTC'), '%F %T.%f');
|
|
|
|
select formatDateTime(toDateTime64('2022-12-08 18:11:29.1234', 1, 'UTC'), '%F %T.%f');
|
|
|
|
select formatDateTime(toDateTime64('2022-12-08 18:11:29.1234', 0, 'UTC'), '%F %T.%f');
|
|
|
|
select formatDateTime(toDateTime('2022-12-08 18:11:29', 'UTC'), '%F %T.%f');
|
|
|
|
select formatDateTime(toDate32('2022-12-08 18:11:29', 'UTC'), '%F %T.%f');
|
|
|
|
select formatDateTime(toDate('2022-12-08 18:11:29', 'UTC'), '%F %T.%f');
|