ClickHouse/tests/queries/0_stateless/01411_from_unixtime.sql
feng lv 767bc7a905 add doc
fix test

fix

name style fix
2020-07-14 18:50:51 +08:00

30 lines
1.8 KiB
SQL

SELECT formatDateTime(FROM_UNIXTIME(123), '%Y-%m-%d %R:%S', 'UTC');
SELECT formatDateTime(FROM_UNIXTIME(123456789), '%Y-%m-%d %R:%S', 'UTC');
SELECT formatDateTime(FROM_UNIXTIME(6457477432), '%Y-%m-%d %R:%S', 'UTC');
SELECT FROM_UNIXTIME(5345345, '%C', 'UTC');
SELECT FROM_UNIXTIME(645123, '%H', 'UTC');
SELECT FROM_UNIXTIME(1232456, '%Y-%m-%d', 'UTC');
SELECT FROM_UNIXTIME(1234356, '%Y-%m-%d %R:%S', 'UTC');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%C');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%d');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%D');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%e');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%F');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%H');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 02:33:44'), '%H');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%I');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 11:33:44'), '%I');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 00:33:44'), '%I');
SELECT FROM_UNIXTIME(toDateTime('2018-01-01 00:33:44'), '%j');
SELECT FROM_UNIXTIME(toDateTime('2000-12-31 00:33:44'), '%j');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%m');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%M');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%n');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 00:33:44'), '%p');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 11:33:44'), '%p');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 12:33:44'), '%p');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%R');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%S');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%t');
SELECT FROM_UNIXTIME(toDateTime('2018-01-02 22:33:44'), '%T');