Date & Time Functions
Formula Pro custom functions for date arithmetic, formatting, and time calculations.
ADD_DAYS
Adds a specified number of days to a date. Returns a date string in YYYY-MM-DD format.
Syntax: ADD_DAYS(date, days)
date
Date, string, or number
The starting date
days
number
Number of days to add (use negative to subtract)
Example:
ADD_DAYS("2025-03-09", 14)Result: "2025-03-23"
SUBTRACT_DAYS
Subtracts a specified number of days from a date. Returns YYYY-MM-DD.
Syntax: SUBTRACT_DAYS(date, days)
Example:
SUBTRACT_DAYS("2025-03-23", 14)Result: "2025-03-09"
DATE_ARITHMETIC
Adds or subtracts days from a date. Same as ADD_DAYS/SUBTRACT_DAYS; use negative days to subtract.
Syntax: DATE_ARITHMETIC(date, days)
Example:
Result: "2025-01-08"
ADD_MINUTES
Adds minutes to a datetime string. Accepts YYYY-MM-DD HH:mm:ss or YYYY-MM-DD. Returns ISO 8601 UTC string.
Syntax: ADD_MINUTES(date, minutes)
Example:
Result: "2025-06-27T08:30:00.000Z" (or equivalent ISO string)
SUBTRACT_MINUTES
Subtracts minutes from a datetime string.
Syntax: SUBTRACT_MINUTES(date, minutes)
DATE_MIN / MIN_DATE
Returns the earliest date from multiple date arguments. Accepts date strings, numbers (timestamps), or timeline strings (YYYY-MM-DD+YYYY-MM-DD).
Syntax: DATE_MIN(date1, date2, ...) or MIN_DATE(...)
Example:
Result: "2025-02-20"
DATE_MAX / MAX_DATE
Returns the latest date from multiple date arguments.
Syntax: DATE_MAX(date1, date2, ...) or MAX_DATE(...)
Example:
Result: "2025-03-15"
WORKDAYS
Calculates the number of working days (Mon–Fri) between two dates.
Syntax: WORKDAYS(toDate, fromDate, [allowNegative])
toDate
End date (YYYY-MM-DD)
fromDate
Start date (YYYY-MM-DD)
allowNegative
Optional. "TRUE" or true to allow negative results; default is false (returns 0 if negative)
Example:
Result: 4 (Mon 9th to Fri 14th = 4 weekdays)
FORMAT_DATE
Formats a date using Moment.js format tokens. Default format is "MMM DD, YYYY".
Syntax: FORMAT_DATE(dateInput, [formatString])
Common format tokens: YYYY (year), MM (month), DD (day), HH (hour), mm (minute), ss (second)
Example:
Result: "Mar 09, 2025"
Example:
Result: "2025-03-09"
TIMEVALUE
Converts a time string to a decimal fraction of a day (Excel-compatible). Supports HH:MM, HH:MM:SS, and AM/PM formats.
Syntax: TIMEVALUE(time_text)
Example:
Result: 0.375 (9 AM = 9/24 of a day)
HOURS_DIFF
Calculates the difference between two time strings in HH:MM format. Supports hours beyond 24.
Syntax: HOURS_DIFF(time1, time2)
Example:
Result: "09:00" (9 hours difference)
Example:
Result: "-09:00"
Last updated