How to use Date Functions
How to use Date Functions
Getting the current date and time
dateTime.today(timeOfDay)
Retrieves the current date and time or the start/end of the day.
"now"
– Returns the current date and time."startOfDay"
– Returns the date at 00:00."endOfDay"
– Returns the date at 23:59.
Adding Days to a Date
dateTime.addDays(date, days)
Adds a specified number of days to a given date.
date – The starting date.
days – The number of days to add.
Formatting a Date
dateTime.formatDate(date)
Converts a date into the YYYY-MM-DD
format for display or logging.
Output
Returns a formatted date, adjusted date, or the current timestamp depending on the function used.
Examples
1.) Getting today’s date and time
dateTime.today("now")
Output: "2025-02-09T14:30:00Z"
2.) Adding days to a date
dateTime.addDays(dateTime.today("now"), 3)
Output: "2025-02-12T14:30:00Z"
When to Use Date Functions
To retrieve dynamic date and time values in automation.
To calculate deadlines, reminders, and scheduled tasks.
To format date values for reports and logs.
To adjust time-related inputs in workflows.