Date Functions

Date functions accept date and datetime inputs as variables or text 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-06-16
NOWCurrent date and time in the workflow timezoneNOW() -> 2026-06-16 17:49:22
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-03-07") → 7
WEEKDAY

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

WEEKDAY("2026-06-16") -> 3
WEEKDAY("2026-06-16", "1") -> 3
WEEKDAY("2026-06-16", "2") -> 2
WEEKDAY("2026-06-16", "3") -> 1

Optional second argument controls numbering:

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

Extract hour (0-23) from date or datetime

HOUR("2019-08-03 14:22:10") → 14
HOUR("1995-12-01") → 0
MINUTE

Extract minute (0-59) from date or datetime

MINUTE("2003-11-25 07:05:33") → 5
MINUTE("1988-04-12") → 0
SECOND

Extract second (0-59) from date or datetime

SECOND("1992-01-07 23:58:41") → 41
SECOND("2010-09-30") → 0
QUARTER

Extract quarter of year (1-4) from date or datetime

QUARTER("2013-02-18") → 1
QUARTER("2013-08-21") → 3
ISOWEEK

ISO week number (1-53). Week starts on Monday; week 1 is the week containing January 4.

ISOWEEK("2021-01-04") → 1
ISOWEEK("2020-12-31") → 53
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-07-18", "month") → 2023-07-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-04-15", "month") → 2024-04-30
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("2019-03-25", "DD/MM/YYYY") → "25/03/2019"
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.
PARSE_DATE

Parse text into a date or datetime value

PARSE_DATE("2015-07-04") → 2015-07-04
PARSE_DATE("03/12/1998", "DD/MM/YYYY") → 1998-12-03
PARSE_DATE("2011-06-22 08:15:30", "YYYY-MM-DD HH:mm:ss") → 2011-06-22 08:15:30
PARSE_DATE("2017-09-05 3:07:11 PM", "YYYY-MM-DD h:mm:ss A") → 2017-09-05 15:07:11

Without a pattern, accepts YYYY-MM-DD and ISO-8601 datetime strings.
With a pattern, uses the same tokens as FORMAT_DATE.
DateTime parsing uses the workflow timezone unless the input or pattern ends with Z.
Patterns using h or hh require an A token for AM/PM.

Date Functions - TemplateDocs Documentation