Manipulate a date
The Manipulate a date helper allows you to change a date by either adding or subtracting time units (years, days, hours and minutes), typically used for scheduling and record-keeping purposes.
The helper takes a date or timestamp and the amount of time (in years, days, hours or minutes) to add or subtract. It returns the updated date or timestamp.
Common use-cases
Adjusting a time to a different timezone
Setting a due date
Search for items from a certain timeframe (e.g., last week, last month, etc.)
Manipulate a date options
The table presents various options for manipulating a date using the Manipulate a date tool.
It's based on an initial input set as Sunday, February 14th, 2010, at 3:25:50 pm:
Subtract
Days
5
2010-02-08T22:00:00.000Z
Add
Hours
23
2010-02-15T12:25:50.000Z
Subtract
Years
5
2005-02-14T13:25:50.000Z
Subtract
Years
7
2016-05-28T11:10:16.000Z
Example 1 - Creating a due date
Let’s say you want to create a feature that creates a task due in a week:
Send email to Ben
March 14, 2023
Step-by-step instructions
You can create a new date seven days from today using the Manipulate a date helper:
Add the action Manipulate a date
Map the current date into the date input (found under Runtime & user attributes).
Choose Add (Add/Subtract), Days (Time unit), and 7 (Amount of time).
The helper will return the date exactly one week from today, which can be used as the due date for your tasks:
Send email to Ben
March 14, 2023
March 21, 2023
Example 2 - Displaying calendar events within a timeframe
Let’s say you want to present your meetings and calls from the last 7 days. Use Search events in your calendar app (e.g. Google Calendar) to get a list of events in a user-defined timeframe. The action requires From date and To date values.
Step-by-step instructions
You can use the current time as the To date and run a Manipulate a date action to create the From date:
Add the Manipulate a date action.
Map the current date into the date input (found under Runtime & user attributes).
Choose Subtract, Days, and 7.
The output is the date seven days ago, and can be used as the beginning of the timeframe.
Add the Search events action.
Choose the calendar you want to search the events in.
Map the previous step’s output in to From date.
Map the current date in to To date (found under Runtime & user attributes).
The output of this step includes all the events from the past seven days.
Last updated