Date Functions

Date functions accept date and datetime inputs as variables or string literals. Supported formats are date values (YYYY-MM-DD) and datetime values (YYYY-MM-DD HH:mm:ss). Datetime extraction and boundary operations use the workflow timezone. Date-only values are timezone agnostic.

FunctionDescriptionExamples
TODAYCurrent date in the workflow timezoneTODAY() -> 2026-03-04
NOWCurrent date and time in the workflow timezoneNOW() -> 2026-03-04 06:07:53
DATE

Create a date from year, month, and day

DATE(2026, 7, 12) → 2026-07-12
YEAR

Extract year from date or datetime

YEAR("2017-11-07") → 2017
MONTH

Extract month (1-12) from date or datetime

MONTH("1996-02-18") → 2
DAY

Extract day of month (1-31) from date or datetime

DAY("1985-06-30 14:22:10") → 30
DAY("2024-02-18") → 18
WEEKDAY

Weekday number (Sunday = 1, Saturday = 7).

WEEKDAY("2026-03-04") -> 4
WEEKDAY("2026-03-04", "1") -> 4
WEEKDAY("2026-03-04", "2") -> 3
WEEKDAY("2026-03-04", "3") -> 2

Optional second argument controls numbering:

  • "1" - Sunday = 1 (default)
  • "2" - Monday = 1
  • "3" - Monday = 0
DATE_ADD

Add a number of units to a date or datetime

DATE_ADD("2021-01-15", 30, "days") → 2021-02-14
DATE_ADD("2012-07-10 09:30:00", 2, "hours") → 2012-07-10 11:30:00
DATE_ADD("1999-12-21", 11, "days") → 2000-01-01

Unit options:

  • "days"
  • "weeks"
  • "months"
  • "years"
  • "hours"
  • "minutes"
  • "seconds"
DATE_DIFF

Difference between two dates in whole units (a - b)

DATE_DIFF("2028-02-15", "2028-02-18", "days") → -3
DATE_DIFF("2008-02-18", "2008-02-15", "days") → 3
DATE_DIFF("1990-03-01", "1990-02-18", "days") → 11

Unit options:

  • "days"
  • "weeks"
  • "months"
  • "years"
  • "hours"
  • "minutes"
  • "seconds"
START_OF

Start of a unit

START_OF("2023-02-18", "month") → 2023-02-01
START_OF("2018-11-09 16:45:20", "day") → 2018-11-09 00:00:00

Unit options:

  • "year"
  • "quarter"
  • "month"
  • "day"
  • "hour"
  • "minute"
  • "second"
END_OF

End of a unit

END_OF("2024-02-18", "month") → 2024-02-29
END_OF("1983-11-09 16:45:20", "day") → 1983-11-09 23:59:59

Unit options:

  • "year"
  • "quarter"
  • "month"
  • "day"
  • "hour"
  • "minute"
  • "second"
FORMAT_DATE

Format date or datetime text using pattern tokens

FORMAT_DATE("2026-02-18", "DD/MM/YYYY") → "18/02/2026"
FORMAT_DATE("2014-11-07", "YYYY-MM-DD") → "2014-11-07"
FORMAT_DATE("2005-03-14 16:05:09", "MM-DD-YY HH:mm:ss") → "03-14-05 16:05:09"
FORMAT_DATE("2022-03-14 16:05:09", "M/D/YYYY h:m:s A") → "3/14/2022 4:5:9 PM"
FORMAT_DATE("1991-09-01", "DD/MM/YYYY") → "01/09/1991"

Supported tokens:

  • YYYY: 4-digit year (e.g. 2026).
  • YY: 2-digit year (e.g. 26).
  • MM: Month with leading zero (01-12).
  • M: Month without leading zero (1-12).
  • DD: Day of month with leading zero (01-31).
  • D: Day of month without leading zero (1-31).
  • HH: 24-hour value with leading zero (00-23).
  • H: 24-hour value without leading zero (0-23).
  • hh: 12-hour value with leading zero (01-12).
  • h: 12-hour value without leading zero (1-12).
  • mm: Minutes with leading zero (00-59).
  • m: Minutes without leading zero (0-59).
  • ss: Seconds with leading zero (00-59).
  • s: Seconds without leading zero (0-59).
  • A: AM/PM marker in uppercase.
Date Functions - TemplateDocs Documentation