Date Functions

type date

Enter dates in Beanquery by writing them in the format YYYY-MM-DD. Example: SELECT account, amount FROM date >= 2022-01-01. Note: Do not enclose them in quotes. For historical reasons, dates in double quotes are accepted, but this is deprecated.

The following functions are available for inspecting and manipulating dates:

  • date() - Construct a date with year, month, day arguments.

  • date_add() - Adds/subtracts number of days from the given date.

  • date_bin() - Bin a date into the specified stride aligned with the specified origin.

  • date_diff() - Calculates the difference (in days) between two dates.

  • date_part() - Extract the specified field from a date.

  • date_trunc() - Truncate a date to the specified precision.

  • day() - Extract the day from a date.

  • interval() - Construct a relative time interval.

  • month() - Extract the month from a date.

  • parse_date() - Parse date from string (first argument).

  • quarter() - Extract the quarter from a date.

  • today() - Today’s date.

  • weekday() - Extract a 3-letter weekday from a date.

  • year() - Extract the year from a date.

  • yearmonth() - Extract the year and month from a date.