Date & Time Functions
add_months
Supported Signatures
function add_months(string, bigint) returns timestamp
convert_timezone
Returns the input timestamp converted from source timezone to a destination timezone Supported Signatures
function convert_timezone $1(varchar, varchar, $1) returns timestamp
where $1 in (timestamp, string)
function convert_timezone $1(varchar, $1) returns timestamp
where $1 in (timestamp, string)
date_from_parts
Construct a date from individual components Supported Signatures
function date_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0)) returns date
date_part
Supported Signatures
function date_part $1(string, $1) returns double
where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, dayofweek, weekday, dow, dw, dayofweekiso, weekday_iso, dow_iso, dw_iso, dayofyear, yearday, doy, dy, week, w, wk, weekofyear, woy, wy, weekiso, week_iso, weekofyeariso, weekofyear_iso, quarter, q, qtr, qtrs, quarters, yearofweek, yearofweekiso, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds, epoch_second, epoch, epoch_seconds, epoch_millisecond, epoch_milliseconds, epoch_microsecond, epoch_microseconds, epoch_nanosecond, epoch_nanoseconds, timezone_hour, tzh, timezone_minute, tzm)
where $1 in (date, time, timestamp, varchar)
date_trunc
Supported Signatures
function date_trunc $1(string, $1) returns $1
where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
where $1 in (date, time, timestamp, varchar)
dateadd
Supported Signatures
function dateadd $1(string, double, $1) returns $1
where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
where $1 in (date, time, timestamp, varchar)
datediff
Supported Signatures
function datediff $1, $2(string, $1, $2) returns bigint
where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
where $1 in (date, time, timestamp, varchar)
and $2 in (date, time, timestamp, varchar)
day
Supported Signatures
function day($1) returns bigint
dayname
Supported Signatures
function dayname $1($1) returns varchar
where $1 in (date, string)
dayofmonth
Supported Signatures
function dayofmonth($1) returns bigint
dayofweek
Supported Signatures
function dayofweek($1) returns bigint
dayofweekiso
Supported Signatures
function dayofweekiso($1) returns bigint
dayofyear
Supported Signatures
function dayofyear($1) returns bigint
extract
Supported Signatures
function extract $1(string, $1) returns double
where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, dayofweek, weekday, dow, dw, dayofweekiso, dayofweek_iso, weekday_iso, dow_iso, dw_iso, dayofyear, yearday, doy, dy, week, w, wk, weekofyear, woy, wy, weekiso, week_iso, weekofyeariso, weekofyear_iso, quarter, q, qtr, qtrs, quarters, yearofweek, yearofweekiso, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds, epoch_second, epoch, epoch_seconds, epoch_millisecond, epoch_milliseconds, epoch_microsecond, epoch_microseconds, epoch_nanosecond, epoch_nanoseconds, timezone_hour, tzh, timezone_minute, tzm)
where $1 in (date, time, timestamp, varchar)
hour
Supported Signatures
function hour($1) returns bigint
last_day
Supported Signatures
function last_day $1($1) returns date
where $1 in (date, time, timestamp, varchar)
function last_day $1($1, string) returns date
where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
where $1 in (date, time, timestamp, varchar)
minute
Supported Signatures
function minute($1) returns bigint
month
Supported Signatures
function month($1) returns bigint
monthname
Supported Signatures
function monthname $1($1) returns varchar
where $1 in (date, string)
months_between
Supported Signatures
function months_between $1($1, $1) returns bigint
where $1 in (date, time, timestamp, varchar)
next_day
Supported Signatures
function next_day $1($1, varchar) returns date
where $1 in (date, string)
previous_day
Supported Signatures
function previous_day $1($1, varchar) returns date
where $1 in (date, string)
quarter
Supported Signatures
function quarter($1) returns bigint
second
Supported Signatures
function second($1) returns bigint
time_from_parts
Construct a time from individual components Supported Signatures
function time_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0)) returns time
function time_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0)) returns time
time_slice
Supported Signatures
function time_slice $1($1, bigint, string) returns $1
where $1 in (date, time, timestamp, varchar)
function time_slice $1($1, bigint, string, string) returns $1
where $1 in (date, time, timestamp, varchar)
timeadd
Supported Signatures
function timeadd $1(string, double, $1) returns $1
where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
where $1 in (date, time, timestamp, varchar)
timediff
Supported Signatures
function timediff $1(string, $1, $1) returns bigint
where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
where $1 in (date, time, timestamp, varchar)
timestamp_from_parts
Construct a timestamp from individual components Supported Signatures
function timestamp_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0)) returns timestamp
function timestamp_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0)) returns timestamp
function timestamp_from_parts(decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), decimal(38, 0), varchar) returns timestamp
function timestamp_from_parts(date, time) returns timestamp
timestampadd
Supported Signatures
function timestampadd $1(string, double, $1) returns $1
where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
where $1 in (date, time, timestamp, varchar)
timestampdiff
Supported Signatures
function timestampdiff $1(string, $1, $1) returns bigint
where string in (year, y, yy, yyy, yyyy, yr, years, yrs, month, mm, mon, mons, months, day, d, dd, days, dayofmonth, week, w, wk, weekofyear, woy, wy, quarter, q, qtr, qtrs, quarters, hour, h, hh, hr, hours, hrs, minute, m, mi, min, minutes, mins, second, s, sec, seconds, secs, millisecond, ms, mesc, milliseconds, microsecond, us,, usec,, microseconds, nanosecond, ns, nsec, nanosec, nsecond, nanoseconds, nanosecs, nseconds)
where $1 in (date, time, timestamp, varchar)
trunc
truncate the fractional or date part Supported Signatures
function trunc(decimal(38, 0)) returns decimal(38, 0)
function trunc(decimal(38, 0), decimal(38, 0)) returns decimal(38, 0)
function trunc(double) returns double
function trunc(double, double) returns double
function trunc(date, varchar) returns date
function trunc(time, varchar) returns time
function trunc(timestamp, varchar) returns timestamp
week
Supported Signatures
function week($1) returns bigint
weekiso
Supported Signatures
function weekiso($1) returns bigint
weekofyear
Supported Signatures
function weekofyear($1) returns bigint
year
Supported Signatures
function year($1) returns bigint
yearofweek
Supported Signatures
function yearofweek($1) returns bigint
yearofweekiso
Supported Signatures
function yearofweekiso($1) returns bigint
function yearofweekiso($1) returns bigint