See date and time operators for infix arithmetic.
| Signature | Description |
|---|---|
current_date() | Returns the current date. |
date(...) | Converts a timestamp or string to a date. |
date_add(...) | Adds a duration or time-unit interval to a date or timestamp. |
date_bin(bucket_width_seconds, origin_seconds, timestamp) | Truncates a timestamp onto a fixed-width grid of `bucket_width_seconds`, anchored at `origin_seconds` (seconds since the Unix epoch). |
date_diff(unit, timestamp1, timestamp2) | Returns the difference between two timestamps in the specified unit. |
date_format(timestamp, format) | Formats a timestamp as a string using the specified format. |
date_trunc(unit, x) | Truncates a timestamp to the specified time unit (e.g., day, month, year). |
day(date) | Extracts the day of the month from a date or timestamp. |
day_of_month(date) | Extracts the day of the month from a timestamp. |
day_of_week(date) | Extracts the day of the week from a timestamp. |
day_of_year(date) | Extracts the day of the month from a timestamp. |
days_in_month(date) | Returns the number of days in the month of the given date. |
dow(date) | Extracts the day of the week from a date or timestamp. |
doy(date) | Extracts the day of the year from a date or timestamp. |
format_datetime(timestamp, format) | Formats a datetime using a specified format string. |
format_datetime_in_timezone(timestamp, format, timezone) | Formats a UTC timestamp as a string using a Joda format pattern in the given IANA timezone. |
from_iso8601_date(string) | Parses an ISO 8601 date string into a date value. |
from_iso8601_timestamp(string) | Parses an ISO 8601 timestamp string into a datetime object. |
from_unix_seconds(unixtime) | Alias for from_unixtime. |
from_unixtime(unixtime, ...) | Converts a UNIX timestamp to a timestamp, optionally with a time zone offset. |
hour(timestamp) | Extracts the hour from a timestamp. |
hour_in_timezone(timestamp, timezone) | Extracts the hour from a timestamp on a given timezone. |
is_business_day(date) | Returns true if the date falls on a weekday (Monday-Friday). |
is_federal_holiday(date) | Returns True if the given timestamp is a federal holiday. |
last_day_of_month(date) | Returns the last day of the month for a given date. |
make_date(year, month, day) | Constructs a date from year, month, and day fields. |
millisecond(timestamp) | Extracts the millisecond from a timestamp. |
minute(timestamp) | Extracts the minute from a timestamp. |
month(date) | Extracts the month from a timestamp. |
parse_datetime(string, format) | Converts an ISO 8601 string into a datetime. |
quarter(timestamp) | Extracts the quarter of the year from a timestamp. |
second(timestamp) | Extracts the second from a timestamp. |
to_days(days) | Constructs a duration with the given number of days. |
to_hours(hours) | Constructs a duration with the given number of hours. |
to_iso8601(timestamp) | Converts a datetime to an ISO 8601 string format. |
to_microseconds(...) | Converts a duration to microseconds or constructs a duration from microseconds. |
to_milliseconds(...) | Converts a duration to milliseconds or constructs a duration from milliseconds. |
to_minutes(minutes) | Constructs a duration with the given number of minutes. |
to_months(months) | Constructs an interval with the given number of months. |
to_seconds(seconds) | Constructs a duration with the given number of seconds. |
to_unix_nanos(timestamp) | Converts a timestamp or date to nanoseconds since the Unix epoch (UTC). Throws if the value falls outside the int64 ns range (~1677 to ~2262). |
to_unixtime(timestamp) | Converts a timestamp to Unix timestamp (seconds since epoch). |
to_years(years) | Constructs an interval with the given number of years. |
total_seconds(duration) | Returns the length of the input duration in seconds. |
week(date) | Extracts the week of the year from a timestamp. |
week_of_year(date) | Extracts the week of the year from a timestamp. |
year(date) | Extracts the year from a timestamp. |
year_of_week(date) | Extracts the year of the ISO week from a date. |
yow(date) | Extracts the year of the ISO week from a date. |
timestamp onto a fixed-width grid of `bucket_width_seconds`, anchored at `origin_seconds` (seconds since the Unix epoch).