2021-09-12 12:35:27 +00:00
|
|
|
-- Tags: long
|
2015-07-02 00:19:31 +00:00
|
|
|
|
2022-03-11 23:45:26 +00:00
|
|
|
/* timestamp 1419800400 == 2014-12-29 00:00:00 (Asia/Istanbul) */
|
|
|
|
/* timestamp 1412106600 == 2014-09-30 23:50:00 (Asia/Istanbul) */
|
|
|
|
/* timestamp 1420102800 == 2015-01-01 12:00:00 (Asia/Istanbul) */
|
|
|
|
/* timestamp 1428310800 == 2015-04-06 12:00:00 (Asia/Istanbul) */
|
|
|
|
/* timestamp 1436956200 == 2015-07-15 13:30:00 (Asia/Istanbul) */
|
|
|
|
/* timestamp 1426415400 == 2015-03-15 13:30:00 (Asia/Istanbul) */
|
|
|
|
/* timestamp 1549483055 == 2019-02-06 22:57:35 (Asia/Istanbul) */
|
2019-02-12 14:18:00 +00:00
|
|
|
/* date 16343 == 2014-09-30 */
|
|
|
|
/* date 16433 == 2014-12-29 */
|
|
|
|
/* date 17933 == 2019-02-06 */
|
|
|
|
|
|
|
|
/* toStartOfDay */
|
|
|
|
|
|
|
|
SELECT 'toStartOfDay';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toStartOfDay(toDateTime(1412106600), 'Asia/Istanbul');
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT toStartOfDay(toDateTime(1412106600), 'Europe/Paris');
|
|
|
|
SELECT toStartOfDay(toDateTime(1412106600), 'Europe/London');
|
|
|
|
SELECT toStartOfDay(toDateTime(1412106600), 'Asia/Tokyo');
|
|
|
|
SELECT toStartOfDay(toDateTime(1412106600), 'Pacific/Pitcairn');
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toStartOfDay(toDate(16343), 'Asia/Istanbul');
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT toStartOfDay(toDate(16343), 'Europe/Paris');
|
|
|
|
SELECT toStartOfDay(toDate(16343), 'Europe/London');
|
|
|
|
SELECT toStartOfDay(toDate(16343), 'Asia/Tokyo');
|
|
|
|
SELECT toStartOfDay(toDate(16343), 'Pacific/Pitcairn');
|
2015-07-02 13:35:28 +00:00
|
|
|
|
2015-07-02 00:19:31 +00:00
|
|
|
/* toMonday */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toMonday';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toMonday(toDateTime(1419800400), 'Asia/Istanbul');
|
2015-07-02 13:35:28 +00:00
|
|
|
SELECT toMonday(toDateTime(1419800400), 'Europe/Paris');
|
|
|
|
SELECT toMonday(toDateTime(1419800400), 'Europe/London');
|
|
|
|
SELECT toMonday(toDateTime(1419800400), 'Asia/Tokyo');
|
|
|
|
SELECT toMonday(toDateTime(1419800400), 'Pacific/Pitcairn');
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT toMonday(toDate(16433));
|
|
|
|
SELECT toMonday(toDate(16433));
|
|
|
|
SELECT toMonday(toDate(16433));
|
|
|
|
SELECT toMonday(toDate(16433));
|
|
|
|
SELECT toMonday(toDate(16433));
|
2015-07-02 00:19:31 +00:00
|
|
|
|
|
|
|
/* toStartOfMonth */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toStartOfMonth';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toStartOfMonth(toDateTime(1419800400), 'Asia/Istanbul');
|
2015-07-02 13:35:28 +00:00
|
|
|
SELECT toStartOfMonth(toDateTime(1419800400), 'Europe/Paris');
|
|
|
|
SELECT toStartOfMonth(toDateTime(1419800400), 'Europe/London');
|
|
|
|
SELECT toStartOfMonth(toDateTime(1419800400), 'Asia/Tokyo');
|
|
|
|
SELECT toStartOfMonth(toDateTime(1419800400), 'Pacific/Pitcairn');
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT toStartOfMonth(toDate(16433));
|
|
|
|
SELECT toStartOfMonth(toDate(16433));
|
|
|
|
SELECT toStartOfMonth(toDate(16433));
|
|
|
|
SELECT toStartOfMonth(toDate(16433));
|
|
|
|
SELECT toStartOfMonth(toDate(16433));
|
2015-07-02 00:19:31 +00:00
|
|
|
|
|
|
|
/* toStartOfQuarter */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toStartOfQuarter';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toStartOfQuarter(toDateTime(1412106600), 'Asia/Istanbul');
|
2015-07-02 13:35:28 +00:00
|
|
|
SELECT toStartOfQuarter(toDateTime(1412106600), 'Europe/Paris');
|
|
|
|
SELECT toStartOfQuarter(toDateTime(1412106600), 'Europe/London');
|
|
|
|
SELECT toStartOfQuarter(toDateTime(1412106600), 'Asia/Tokyo');
|
|
|
|
SELECT toStartOfQuarter(toDateTime(1412106600), 'Pacific/Pitcairn');
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT toStartOfQuarter(toDate(16343));
|
|
|
|
SELECT toStartOfQuarter(toDate(16343));
|
|
|
|
SELECT toStartOfQuarter(toDate(16343));
|
|
|
|
SELECT toStartOfQuarter(toDate(16343));
|
|
|
|
SELECT toStartOfQuarter(toDate(16343));
|
2015-07-02 00:19:31 +00:00
|
|
|
|
2017-10-30 06:27:21 +00:00
|
|
|
/* toStartOfYear */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toStartOfYear';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toStartOfYear(toDateTime(1419800400), 'Asia/Istanbul');
|
2017-10-30 06:27:21 +00:00
|
|
|
SELECT toStartOfYear(toDateTime(1419800400), 'Europe/Paris');
|
|
|
|
SELECT toStartOfYear(toDateTime(1419800400), 'Europe/London');
|
|
|
|
SELECT toStartOfYear(toDateTime(1419800400), 'Asia/Tokyo');
|
|
|
|
SELECT toStartOfYear(toDateTime(1419800400), 'Pacific/Pitcairn');
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT toStartOfYear(toDate(16433));
|
|
|
|
SELECT toStartOfYear(toDate(16433));
|
|
|
|
SELECT toStartOfYear(toDate(16433));
|
|
|
|
SELECT toStartOfYear(toDate(16433));
|
|
|
|
SELECT toStartOfYear(toDate(16433));
|
2017-10-30 06:27:21 +00:00
|
|
|
|
2015-07-02 00:19:31 +00:00
|
|
|
/* toTime */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toTime';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toString(toTime(toDateTime(1420102800), 'Asia/Istanbul'), 'Asia/Istanbul'), toString(toTime(toDateTime(1428310800), 'Asia/Istanbul'), 'Asia/Istanbul');
|
2017-01-22 13:21:59 +00:00
|
|
|
SELECT toString(toTime(toDateTime(1420102800), 'Europe/Paris'), 'Europe/Paris'), toString(toTime(toDateTime(1428310800), 'Europe/Paris'), 'Europe/Paris');
|
|
|
|
SELECT toString(toTime(toDateTime(1420102800), 'Europe/London'), 'Europe/London'), toString(toTime(toDateTime(1428310800), 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT toString(toTime(toDateTime(1420102800), 'Asia/Tokyo'), 'Asia/Tokyo'), toString(toTime(toDateTime(1428310800), 'Asia/Tokyo'), 'Asia/Tokyo');
|
|
|
|
SELECT toString(toTime(toDateTime(1420102800), 'Pacific/Pitcairn'), 'Pacific/Pitcairn'), toString(toTime(toDateTime(1428310800), 'Pacific/Pitcairn'), 'Pacific/Pitcairn');
|
2015-07-02 13:35:28 +00:00
|
|
|
|
2015-10-22 15:31:42 +00:00
|
|
|
/* toYear */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toYear';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toYear(toDateTime(1412106600), 'Asia/Istanbul');
|
2015-10-22 15:31:42 +00:00
|
|
|
SELECT toYear(toDateTime(1412106600), 'Europe/Paris');
|
|
|
|
SELECT toYear(toDateTime(1412106600), 'Europe/London');
|
|
|
|
SELECT toYear(toDateTime(1412106600), 'Asia/Tokyo');
|
|
|
|
SELECT toYear(toDateTime(1412106600), 'Pacific/Pitcairn');
|
|
|
|
|
|
|
|
/* toMonth */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toMonth';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toMonth(toDateTime(1412106600), 'Asia/Istanbul');
|
2015-10-22 15:31:42 +00:00
|
|
|
SELECT toMonth(toDateTime(1412106600), 'Europe/Paris');
|
|
|
|
SELECT toMonth(toDateTime(1412106600), 'Europe/London');
|
|
|
|
SELECT toMonth(toDateTime(1412106600), 'Asia/Tokyo');
|
|
|
|
SELECT toMonth(toDateTime(1412106600), 'Pacific/Pitcairn');
|
|
|
|
|
|
|
|
/* toDayOfMonth */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toDayOfMonth';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toDayOfMonth(toDateTime(1412106600), 'Asia/Istanbul');
|
2015-10-22 15:31:42 +00:00
|
|
|
SELECT toDayOfMonth(toDateTime(1412106600), 'Europe/Paris');
|
|
|
|
SELECT toDayOfMonth(toDateTime(1412106600), 'Europe/London');
|
|
|
|
SELECT toDayOfMonth(toDateTime(1412106600), 'Asia/Tokyo');
|
|
|
|
SELECT toDayOfMonth(toDateTime(1412106600), 'Pacific/Pitcairn');
|
|
|
|
|
|
|
|
/* toDayOfWeek */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toDayOfWeek';
|
2023-01-13 14:00:16 +00:00
|
|
|
SELECT toDayOfWeek(toDateTime(1412106600), 0, 'Asia/Istanbul');
|
|
|
|
SELECT toDayOfWeek(toDateTime(1412106600), 0, 'Europe/Paris');
|
|
|
|
SELECT toDayOfWeek(toDateTime(1412106600), 0, 'Europe/London');
|
|
|
|
SELECT toDayOfWeek(toDateTime(1412106600), 0, 'Asia/Tokyo');
|
|
|
|
SELECT toDayOfWeek(toDateTime(1412106600), 0, 'Pacific/Pitcairn');
|
2015-10-22 15:31:42 +00:00
|
|
|
|
|
|
|
/* toHour */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toHour';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toHour(toDateTime(1412106600), 'Asia/Istanbul');
|
2015-10-22 15:31:42 +00:00
|
|
|
SELECT toHour(toDateTime(1412106600), 'Europe/Paris');
|
|
|
|
SELECT toHour(toDateTime(1412106600), 'Europe/London');
|
|
|
|
SELECT toHour(toDateTime(1412106600), 'Asia/Tokyo');
|
|
|
|
SELECT toHour(toDateTime(1412106600), 'Pacific/Pitcairn');
|
|
|
|
|
|
|
|
/* toMinute */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toMinute';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toMinute(toDateTime(1412106600), 'Asia/Istanbul');
|
2015-10-22 15:31:42 +00:00
|
|
|
SELECT toMinute(toDateTime(1412106600), 'Europe/Paris');
|
|
|
|
SELECT toMinute(toDateTime(1412106600), 'Europe/London');
|
|
|
|
SELECT toMinute(toDateTime(1412106600), 'Asia/Tokyo');
|
|
|
|
SELECT toMinute(toDateTime(1412106600), 'Pacific/Pitcairn');
|
|
|
|
|
|
|
|
/* toSecond */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toSecond';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toSecond(toDateTime(1412106600), 'Asia/Istanbul');
|
2015-10-22 15:31:42 +00:00
|
|
|
SELECT toSecond(toDateTime(1412106600), 'Europe/Paris');
|
|
|
|
SELECT toSecond(toDateTime(1412106600), 'Europe/London');
|
|
|
|
SELECT toSecond(toDateTime(1412106600), 'Asia/Tokyo');
|
|
|
|
SELECT toSecond(toDateTime(1412106600), 'Pacific/Pitcairn');
|
|
|
|
|
|
|
|
/* toStartOfMinute */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toStartOfMinute';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toString(toStartOfMinute(toDateTime(1549483055), 'Asia/Istanbul'), 'Asia/Istanbul');
|
2019-02-06 22:50:04 +00:00
|
|
|
SELECT toString(toStartOfMinute(toDateTime(1549483055), 'Europe/Paris'), 'Europe/Paris');
|
|
|
|
SELECT toString(toStartOfMinute(toDateTime(1549483055), 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT toString(toStartOfMinute(toDateTime(1549483055), 'Asia/Tokyo'), 'Asia/Tokyo');
|
|
|
|
SELECT toString(toStartOfMinute(toDateTime(1549483055), 'Pacific/Pitcairn'), 'Pacific/Pitcairn');
|
|
|
|
|
2022-04-22 02:49:59 +00:00
|
|
|
/* toStartOfFiveMinutes */
|
|
|
|
|
|
|
|
SELECT 'toStartOfFiveMinutes';
|
2022-05-27 00:04:42 +00:00
|
|
|
SELECT toString(toStartOfFiveMinutes(toDateTime(1549483055), 'Asia/Istanbul'), 'Asia/Istanbul');
|
2022-04-22 02:49:59 +00:00
|
|
|
SELECT toString(toStartOfFiveMinutes(toDateTime(1549483055), 'Europe/Paris'), 'Europe/Paris');
|
|
|
|
SELECT toString(toStartOfFiveMinutes(toDateTime(1549483055), 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT toString(toStartOfFiveMinutes(toDateTime(1549483055), 'Asia/Tokyo'), 'Asia/Tokyo');
|
|
|
|
SELECT toString(toStartOfFiveMinutes(toDateTime(1549483055), 'Pacific/Pitcairn'), 'Pacific/Pitcairn');
|
2019-02-06 22:50:04 +00:00
|
|
|
|
|
|
|
/* toStartOfTenMinutes */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toStartOfTenMinutes';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toString(toStartOfTenMinutes(toDateTime(1549483055), 'Asia/Istanbul'), 'Asia/Istanbul');
|
2019-02-06 22:50:04 +00:00
|
|
|
SELECT toString(toStartOfTenMinutes(toDateTime(1549483055), 'Europe/Paris'), 'Europe/Paris');
|
|
|
|
SELECT toString(toStartOfTenMinutes(toDateTime(1549483055), 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT toString(toStartOfTenMinutes(toDateTime(1549483055), 'Asia/Tokyo'), 'Asia/Tokyo');
|
|
|
|
SELECT toString(toStartOfTenMinutes(toDateTime(1549483055), 'Pacific/Pitcairn'), 'Pacific/Pitcairn');
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
/* toStartOfFifteenMinutes */
|
2019-02-06 22:50:04 +00:00
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toStartOfFifteenMinutes';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toString(toStartOfFifteenMinutes(toDateTime(1549483055), 'Asia/Istanbul'), 'Asia/Istanbul');
|
2019-02-06 22:50:04 +00:00
|
|
|
SELECT toString(toStartOfFifteenMinutes(toDateTime(1549483055), 'Europe/Paris'), 'Europe/Paris');
|
|
|
|
SELECT toString(toStartOfFifteenMinutes(toDateTime(1549483055), 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT toString(toStartOfFifteenMinutes(toDateTime(1549483055), 'Asia/Tokyo'), 'Asia/Tokyo');
|
|
|
|
SELECT toString(toStartOfFifteenMinutes(toDateTime(1549483055), 'Pacific/Pitcairn'), 'Pacific/Pitcairn');
|
2015-10-22 15:31:42 +00:00
|
|
|
|
|
|
|
/* toStartOfHour */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toStartOfHour';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toString(toStartOfHour(toDateTime(1549483055), 'Asia/Istanbul'), 'Asia/Istanbul');
|
2019-02-06 22:50:04 +00:00
|
|
|
SELECT toString(toStartOfHour(toDateTime(1549483055), 'Europe/Paris'), 'Europe/Paris');
|
|
|
|
SELECT toString(toStartOfHour(toDateTime(1549483055), 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT toString(toStartOfHour(toDateTime(1549483055), 'Asia/Tokyo'), 'Asia/Tokyo');
|
|
|
|
SELECT toString(toStartOfHour(toDateTime(1549483055), 'Pacific/Pitcairn'), 'Pacific/Pitcairn');
|
2015-10-22 15:31:42 +00:00
|
|
|
|
2019-02-11 11:59:17 +00:00
|
|
|
/* toStartOfInterval */
|
2019-02-12 14:18:00 +00:00
|
|
|
|
|
|
|
SELECT 'toStartOfInterval';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 1 year, 'Asia/Istanbul');
|
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 2 year, 'Asia/Istanbul');
|
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 5 year, 'Asia/Istanbul');
|
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 1 quarter, 'Asia/Istanbul');
|
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 2 quarter, 'Asia/Istanbul');
|
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 3 quarter, 'Asia/Istanbul');
|
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 1 month, 'Asia/Istanbul');
|
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 2 month, 'Asia/Istanbul');
|
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 5 month, 'Asia/Istanbul');
|
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 1 week, 'Asia/Istanbul');
|
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 2 week, 'Asia/Istanbul');
|
|
|
|
SELECT toStartOfInterval(toDateTime(1549483055), INTERVAL 6 week, 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 1 day, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 2 day, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 5 day, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 1 hour, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 2 hour, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 6 hour, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 24 hour, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 1 minute, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 2 minute, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 5 minute, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 20 minute, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 90 minute, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 1 second, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 2 second, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDateTime(1549483055), INTERVAL 5 second, 'Asia/Istanbul'), 'Asia/Istanbul');
|
2019-02-11 11:59:17 +00:00
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 1 year);
|
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 2 year);
|
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 5 year);
|
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 1 quarter);
|
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 2 quarter);
|
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 3 quarter);
|
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 1 month);
|
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 2 month);
|
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 5 month);
|
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 1 week);
|
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 2 week);
|
|
|
|
SELECT toStartOfInterval(toDate(17933), INTERVAL 6 week);
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toString(toStartOfInterval(toDate(17933), INTERVAL 1 day, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDate(17933), INTERVAL 2 day, 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toString(toStartOfInterval(toDate(17933), INTERVAL 5 day, 'Asia/Istanbul'), 'Asia/Istanbul');
|
2019-02-11 11:59:17 +00:00
|
|
|
|
2015-10-22 15:31:42 +00:00
|
|
|
/* toRelativeYearNum */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toRelativeYearNum';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toRelativeYearNum(toDateTime(1412106600), 'Asia/Istanbul') - toRelativeYearNum(toDateTime(0), 'Asia/Istanbul');
|
2017-10-26 18:09:02 +00:00
|
|
|
SELECT toRelativeYearNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeYearNum(toDateTime(0), 'Europe/Paris');
|
|
|
|
SELECT toRelativeYearNum(toDateTime(1412106600), 'Europe/London') - toRelativeYearNum(toDateTime(0), 'Europe/London');
|
|
|
|
SELECT toRelativeYearNum(toDateTime(1412106600), 'Asia/Tokyo') - toRelativeYearNum(toDateTime(0), 'Asia/Tokyo');
|
|
|
|
SELECT toRelativeYearNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelativeYearNum(toDateTime(0), 'Pacific/Pitcairn');
|
2015-10-22 15:31:42 +00:00
|
|
|
|
|
|
|
/* toRelativeMonthNum */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toRelativeMonthNum';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toRelativeMonthNum(toDateTime(1412106600), 'Asia/Istanbul') - toRelativeMonthNum(toDateTime(0), 'Asia/Istanbul');
|
2017-10-26 18:09:02 +00:00
|
|
|
SELECT toRelativeMonthNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeMonthNum(toDateTime(0), 'Europe/Paris');
|
|
|
|
SELECT toRelativeMonthNum(toDateTime(1412106600), 'Europe/London') - toRelativeMonthNum(toDateTime(0), 'Europe/London');
|
|
|
|
SELECT toRelativeMonthNum(toDateTime(1412106600), 'Asia/Tokyo') - toRelativeMonthNum(toDateTime(0), 'Asia/Tokyo');
|
|
|
|
SELECT toRelativeMonthNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelativeMonthNum(toDateTime(0), 'Pacific/Pitcairn');
|
2015-10-22 15:31:42 +00:00
|
|
|
|
|
|
|
/* toRelativeWeekNum */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toRelativeWeekNum';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toRelativeWeekNum(toDateTime(1412106600), 'Asia/Istanbul') - toRelativeWeekNum(toDateTime(0), 'Asia/Istanbul');
|
2017-10-26 18:09:02 +00:00
|
|
|
SELECT toRelativeWeekNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeWeekNum(toDateTime(0), 'Europe/Paris');
|
|
|
|
SELECT toRelativeWeekNum(toDateTime(1412106600), 'Europe/London') - toRelativeWeekNum(toDateTime(0), 'Europe/London');
|
|
|
|
SELECT toRelativeWeekNum(toDateTime(1412106600), 'Asia/Tokyo') - toRelativeWeekNum(toDateTime(0), 'Asia/Tokyo');
|
|
|
|
SELECT toRelativeWeekNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelativeWeekNum(toDateTime(0), 'Pacific/Pitcairn');
|
2015-10-22 15:31:42 +00:00
|
|
|
|
|
|
|
/* toRelativeDayNum */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toRelativeDayNum';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toRelativeDayNum(toDateTime(1412106600), 'Asia/Istanbul') - toRelativeDayNum(toDateTime(0), 'Asia/Istanbul');
|
2017-10-26 18:09:02 +00:00
|
|
|
SELECT toRelativeDayNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeDayNum(toDateTime(0), 'Europe/Paris');
|
|
|
|
SELECT toRelativeDayNum(toDateTime(1412106600), 'Europe/London') - toRelativeDayNum(toDateTime(0), 'Europe/London');
|
|
|
|
SELECT toRelativeDayNum(toDateTime(1412106600), 'Asia/Tokyo') - toRelativeDayNum(toDateTime(0), 'Asia/Tokyo');
|
2021-03-08 00:14:39 +00:00
|
|
|
-- NOTE: toRelativeDayNum(toDateTime(0), 'Pacific/Pitcairn') overflows from -1 to 65535
|
|
|
|
SELECT toUInt16(toRelativeDayNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelativeDayNum(toDateTime(0), 'Pacific/Pitcairn'));
|
2015-10-22 15:31:42 +00:00
|
|
|
|
|
|
|
/* toRelativeHourNum */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toRelativeHourNum';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toRelativeHourNum(toDateTime(1412106600), 'Asia/Istanbul') - toRelativeHourNum(toDateTime(0), 'Asia/Istanbul');
|
2017-10-26 18:09:02 +00:00
|
|
|
SELECT toRelativeHourNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeHourNum(toDateTime(0), 'Europe/Paris');
|
|
|
|
SELECT toRelativeHourNum(toDateTime(1412106600), 'Europe/London') - toRelativeHourNum(toDateTime(0), 'Europe/London');
|
|
|
|
SELECT toRelativeHourNum(toDateTime(1412106600), 'Asia/Tokyo') - toRelativeHourNum(toDateTime(0), 'Asia/Tokyo');
|
2021-03-08 00:14:39 +00:00
|
|
|
SELECT toRelativeHourNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelativeHourNum(toDateTime(0), 'Pacific/Pitcairn');
|
2015-10-22 15:31:42 +00:00
|
|
|
|
|
|
|
/* toRelativeMinuteNum */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toRelativeMinuteNum';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toRelativeMinuteNum(toDateTime(1412106600), 'Asia/Istanbul') - toRelativeMinuteNum(toDateTime(0), 'Asia/Istanbul');
|
2017-10-26 18:09:02 +00:00
|
|
|
SELECT toRelativeMinuteNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeMinuteNum(toDateTime(0), 'Europe/Paris');
|
|
|
|
SELECT toRelativeMinuteNum(toDateTime(1412106600), 'Europe/London') - toRelativeMinuteNum(toDateTime(0), 'Europe/London');
|
|
|
|
SELECT toRelativeMinuteNum(toDateTime(1412106600), 'Asia/Tokyo') - toRelativeMinuteNum(toDateTime(0), 'Asia/Tokyo');
|
|
|
|
SELECT toRelativeMinuteNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelativeMinuteNum(toDateTime(0), 'Pacific/Pitcairn');
|
2015-10-22 15:31:42 +00:00
|
|
|
|
|
|
|
/* toRelativeSecondNum */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toRelativeSecondNum';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toRelativeSecondNum(toDateTime(1412106600), 'Asia/Istanbul') - toRelativeSecondNum(toDateTime(0), 'Asia/Istanbul');
|
2017-10-26 18:09:02 +00:00
|
|
|
SELECT toRelativeSecondNum(toDateTime(1412106600), 'Europe/Paris') - toRelativeSecondNum(toDateTime(0), 'Europe/Paris');
|
|
|
|
SELECT toRelativeSecondNum(toDateTime(1412106600), 'Europe/London') - toRelativeSecondNum(toDateTime(0), 'Europe/London');
|
|
|
|
SELECT toRelativeSecondNum(toDateTime(1412106600), 'Asia/Tokyo') - toRelativeSecondNum(toDateTime(0), 'Asia/Tokyo');
|
|
|
|
SELECT toRelativeSecondNum(toDateTime(1412106600), 'Pacific/Pitcairn') - toRelativeSecondNum(toDateTime(0), 'Pacific/Pitcairn');
|
2015-10-22 15:31:42 +00:00
|
|
|
|
|
|
|
/* toDate */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toDate';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toDate(toDateTime(1412106600), 'Asia/Istanbul');
|
2015-10-22 15:31:42 +00:00
|
|
|
SELECT toDate(toDateTime(1412106600), 'Europe/Paris');
|
|
|
|
SELECT toDate(toDateTime(1412106600), 'Europe/London');
|
|
|
|
SELECT toDate(toDateTime(1412106600), 'Asia/Tokyo');
|
|
|
|
SELECT toDate(toDateTime(1412106600), 'Pacific/Pitcairn');
|
|
|
|
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toDate(1412106600, 'Asia/Istanbul');
|
2015-10-22 15:31:42 +00:00
|
|
|
SELECT toDate(1412106600, 'Europe/Paris');
|
|
|
|
SELECT toDate(1412106600, 'Europe/London');
|
|
|
|
SELECT toDate(1412106600, 'Asia/Tokyo');
|
|
|
|
SELECT toDate(1412106600, 'Pacific/Pitcairn');
|
|
|
|
|
2020-08-17 09:47:16 +00:00
|
|
|
SELECT toDate(16343);
|
|
|
|
|
2015-07-02 00:19:31 +00:00
|
|
|
/* toString */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toString';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toString(toDateTime(1436956200), 'Asia/Istanbul');
|
2015-07-02 13:35:28 +00:00
|
|
|
SELECT toString(toDateTime(1436956200), 'Europe/Paris');
|
|
|
|
SELECT toString(toDateTime(1436956200), 'Europe/London');
|
|
|
|
SELECT toString(toDateTime(1436956200), 'Asia/Tokyo');
|
|
|
|
SELECT toString(toDateTime(1436956200), 'Pacific/Pitcairn');
|
2015-07-02 00:19:31 +00:00
|
|
|
|
|
|
|
/* toUnixTimestamp */
|
|
|
|
|
2019-02-12 14:18:00 +00:00
|
|
|
SELECT 'toUnixTimestamp';
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Asia/Istanbul'), 'Asia/Istanbul');
|
|
|
|
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Asia/Istanbul'), 'Europe/Paris');
|
|
|
|
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Asia/Istanbul'), 'Europe/London');
|
|
|
|
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Asia/Istanbul'), 'Asia/Tokyo');
|
|
|
|
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Asia/Istanbul'), 'Pacific/Pitcairn');
|
2015-07-02 00:19:31 +00:00
|
|
|
|
2022-03-11 23:45:26 +00:00
|
|
|
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Asia/Istanbul'), 'Asia/Istanbul');
|
2015-07-02 13:35:28 +00:00
|
|
|
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Europe/Paris'), 'Europe/Paris');
|
|
|
|
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Asia/Tokyo'), 'Asia/Tokyo');
|
|
|
|
SELECT toUnixTimestamp(toString(toDateTime(1426415400), 'Pacific/Pitcairn'), 'Pacific/Pitcairn');
|
2020-08-17 09:47:16 +00:00
|
|
|
|
|
|
|
/* date_trunc */
|
|
|
|
|
|
|
|
SELECT 'date_trunc';
|
|
|
|
|
|
|
|
SELECT date_trunc('year', toDateTime('2020-01-01 04:11:22', 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('year', toDateTime('2020-01-01 12:11:22', 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('year', toDateTime('2020-01-01 20:11:22', 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('quarter', toDateTime('2020-01-01 04:11:22', 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('quarter', toDateTime('2020-01-01 12:11:22', 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('quarter', toDateTime('2020-01-01 20:11:22', 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('month', toDateTime('2020-01-01 04:11:22', 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('month', toDateTime('2020-01-01 12:11:22', 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('month', toDateTime('2020-01-01 20:11:22', 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('week', toDateTime('2020-01-01 04:11:22', 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('week', toDateTime('2020-01-01 12:11:22', 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('week', toDateTime('2020-01-01 20:11:22', 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('day', toDateTime('2020-01-01 04:11:22', 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('day', toDateTime('2020-01-01 12:11:22', 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('day', toDateTime('2020-01-01 20:11:22', 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('hour', toDateTime('2020-01-01 04:11:22', 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('hour', toDateTime('2020-01-01 12:11:22', 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('hour', toDateTime('2020-01-01 20:11:22', 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('minute', toDateTime('2020-01-01 04:11:22', 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('minute', toDateTime('2020-01-01 12:11:22', 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('minute', toDateTime('2020-01-01 20:11:22', 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('second', toDateTime('2020-01-01 04:11:22', 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('second', toDateTime('2020-01-01 12:11:22', 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('second', toDateTime('2020-01-01 20:11:22', 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
|
|
|
|
SELECT date_trunc('year', toDateTime64('2020-01-01 04:11:22.123', 3, 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('year', toDateTime64('2020-01-01 12:11:22.123', 3, 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('year', toDateTime64('2020-01-01 20:11:22.123', 3, 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('quarter', toDateTime64('2020-01-01 04:11:22.123', 3, 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('quarter', toDateTime64('2020-01-01 12:11:22.123', 3, 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('quarter', toDateTime64('2020-01-01 20:11:22.123', 3, 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('month', toDateTime64('2020-01-01 04:11:22.123', 3, 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('month', toDateTime64('2020-01-01 12:11:22.123', 3, 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('month', toDateTime64('2020-01-01 20:11:22.123', 3, 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('week', toDateTime64('2020-01-01 04:11:22.123', 3, 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('week', toDateTime64('2020-01-01 12:11:22.123', 3, 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('week', toDateTime64('2020-01-01 20:11:22.123', 3, 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('day', toDateTime64('2020-01-01 04:11:22.123', 3, 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('day', toDateTime64('2020-01-01 12:11:22.123', 3, 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('day', toDateTime64('2020-01-01 20:11:22.123', 3, 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('hour', toDateTime64('2020-01-01 04:11:22.123', 3, 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('hour', toDateTime64('2020-01-01 12:11:22.123', 3, 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('hour', toDateTime64('2020-01-01 20:11:22.123', 3, 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('minute', toDateTime64('2020-01-01 04:11:22.123', 3, 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('minute', toDateTime64('2020-01-01 12:11:22.123', 3, 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('minute', toDateTime64('2020-01-01 20:11:22.123', 3, 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
SELECT date_trunc('second', toDateTime64('2020-01-01 04:11:22.123', 3, 'Europe/London'), 'America/Vancouver');
|
|
|
|
SELECT date_trunc('second', toDateTime64('2020-01-01 12:11:22.123', 3, 'Europe/London'), 'Europe/London');
|
|
|
|
SELECT date_trunc('second', toDateTime64('2020-01-01 20:11:22.123', 3, 'Europe/London'), 'Asia/Tokyo');
|
|
|
|
|
|
|
|
SELECT date_trunc('year', toDate('2020-01-01', 'Europe/London'));
|
|
|
|
SELECT date_trunc('quarter', toDate('2020-01-01', 'Europe/London'));
|
|
|
|
SELECT date_trunc('month', toDate('2020-01-01', 'Europe/London'));
|
|
|
|
SELECT date_trunc('week', toDate('2020-01-01', 'Europe/London'));
|
|
|
|
SELECT date_trunc('day', toDate('2020-01-01', 'Europe/London'), 'America/Vancouver');
|