Functions for working with date and time
once
long
1000
10000
datetime_transform
toSecond
toMinute
toHour
toDayOfWeek
toDayOfMonth
toDayOfYear
toMonth
toQuarter
toYear
toISOWeek
toISOYear
toStartOfMinute
toStartOfFiveMinute
toStartOfFifteenMinutes
toStartOfHour
toStartOfDay
toDate
toMonday
toStartOfMonth
toStartOfQuarter
toStartOfYear
toStartOfISOYear
toTime
toRelativeYearNum
toRelativeMonthNum
toRelativeWeekNum
toRelativeDayNum
toRelativeHourNum
toRelativeMinuteNum
toRelativeSecondNum
toYYYYMM
toYYYYMMDD
toYYYYMMDDhhmmss
date_transform
toDayOfWeek
toDayOfMonth
toDayOfYear
toMonth
toQuarter
toYear
toISOWeek
toISOYear
toDate
toMonday
toStartOfMonth
toStartOfQuarter
toStartOfYear
toStartOfISOYear
toRelativeYearNum
toRelativeMonthNum
toRelativeWeekNum
toRelativeDayNum
toYYYYMM
toYYYYMMDD
toYYYYMMDDhhmmss
time_zone
UTC
Europe/Moscow
Asia/Kolkata
SELECT count() FROM system.numbers WHERE NOT ignore(toDateTime('2017-01-01 00:00:00') + number % 100000000 + rand() % 100000 AS t, {datetime_transform}(t, '{time_zone}'))
SELECT count() FROM system.numbers WHERE NOT ignore(toDate('2017-01-01') + number % 1000 + rand() % 10 AS t, {date_transform}(t))