date Module
Everything you need to work with dates and timestamps in RQL.
Quick Example
$ Quick Example
Date Extraction
Pull out the parts you need from any date or timestamp.
date::year
Extract the year from a date
date::month
Extract the month (1-12) from a date
date::day
Extract the day of the month from a date
date::day_of_year
Get the day of the year (1-366)
date::day_of_week
Get the day of the week (1=Monday, 7=Sunday)
date::quarter
Get the quarter (1-4)
date::week
Get the ISO week number (1-53)
Date Properties
Inspect properties and boundaries of dates.
Date Manipulation
Add time, compute differences, or grab the current timestamp.
date::new
Create a new date from year, month, and day
date::now
Get the current timestamp
date::add
Add time to a date
date::subtract
Subtract a duration from a date
date::diff
Calculate the difference between two dates
date::trunc
Truncate a date to a specified precision
date::age
Calculate the duration between two dates
Formatting
Turn dates into readable strings.
Function Reference
| Function | Category | Description |
|---|---|---|
date::year | Extraction | Extract the year from a date |
date::month | Extraction | Extract the month (1-12) from a date |
date::day | Extraction | Extract the day of the month from a date |
date::day_of_year | Extraction | Get the day of the year (1-366) |
date::day_of_week | Extraction | Get the day of the week (1=Monday, 7=Sunday) |
date::quarter | Extraction | Get the quarter (1-4) |
date::week | Extraction | Get the ISO week number (1-53) |
date::is_leap_year | Properties | Check if a date falls in a leap year |
date::days_in_month | Properties | Get the number of days in the month |
date::start_of_month | Properties | Get the first day of the month |
date::end_of_month | Properties | Get the last day of the month |
date::start_of_year | Properties | Get the first day of the year |
date::new | Manipulation | Create a new date from components |
date::now | Manipulation | Get the current timestamp |
date::add | Manipulation | Add time to a date |
date::subtract | Manipulation | Subtract a duration from a date |
date::diff | Manipulation | Calculate the difference between two dates |
date::trunc | Manipulation | Truncate a date to a specified precision |
date::age | Manipulation | Calculate the duration between two dates |
date::format | Formatting | Format a date as a string |
