Carrot reference
Functions

date()

Converts a value to a Date, including handling relative dates.

Syntax

date(value[, startingDate])

  • value - the value to convert to a date. This value may be an exact date ("2025-01-01"), or in Relative Dates form ("+1w+3d")
    • If passed a Number, then the number will be assumed to be a Unix Timestamp (seconds since the epoch)
  • startingDate (optional) if passed, will use this date as the starting-point date for the relative date

Return Type

Date, or Null if unable to parse or convert the value into a date

Examples

date() returns the current date.

date("-3m") returns the date three months ago

date(1744206569) returns the date of April 9, 2025 (by converting from a unix timestamp)

date("2025-12-25") returns the exact date of Dec 25, 2025

date("+6w", createDate) returns a date six weeks from the value of createDate.