Workflows · Task additions · Relative dates
Relative dates and times can be used in date properties like start_date or end_date.
Usage
task:
    type: from_google_analytics
    start_date: yesterday -3 days
    end_date: today
Commands
The commands below are responsible for date and time manipulation. The timestamp at which Workflows commence is referred to as the "trigger_date." In the context of running tasks in the Sandbox or manual mode, the trigger_date typically corresponds to the current time. However, in the case of a scheduled job, the trigger date for the task aligns with the moment the job is actually initiated.
To illustrate, if the job is scheduled to run every day at 16:05, the trigger date for all tasks within that job will be 16:05 on that specific day. It's important to note that the date-time value is truncated to the minute, meaning that any (fractional) seconds will be rounded down to 0.
| command | description | 
|---|
| today | Will pick the trigger_date of the job and truncate it to the day (sets the hours, minutes and seconds to zero). | 
| yesterday | Will pick the trigger_date of the job, truncate it to the day (sets the hours, minutes and seconds to zero) and subtract one day. | 
| tomorrow | Will pick the trigger_date of the job and truncate it to the day (sets the hours, minutes and seconds to zero) and add one day. | 
| current_hour | Will pick the trigger_date of the job and truncate it to the hour (sets the minutes and seconds to zero). | 
| monday | Last complete Monday. | 
| tuesday | Last complete Tuesday. | 
| wednesday | Last complete Wednesday. | 
| thursday | Last complete Thursday. | 
| friday | Last complete Friday. | 
| saturday | Last complete Saturday. | 
| sunday | Last complete Sunday. | 
| first | First day of the current month. It will be today if it is the first of the month. | 
| last | Last day of the previous month. | 
Adding and subtracting time frames
| command | description | 
|---|
| + X hour(s)/day(s)/week(s)/month(s)/year(s) | Adds X hour(s)/day(s)/week(s)/month(s)/year(s) to the point in time above. You can use this multiple times. E.g. first +1 day +4 hours | 
| - X hour(s)/day(s)/week(s)/month(s)/year(s) | Subtract X hour(s)/day(s)/week(s)/month(s)/year(s) to the point in time above. You can use this multiple times. E.g. first -1 day -4 hours | 
Examples
| trigger_date | relative date | resulting date | 
|---|
| 2023-11-14 07:15:13.456 | today | 2023-11-14 00:00:00 | 
| 2023-11-14 07:15:13.456 | -1 hour | 2023-11-14 06:15:00 | 
| 2023-11-14 07:15:13.456 | today -1 day | 2023-11-13 00:00:00 | 
| 2023-11-14 07:15:13.456 | today -2 month | 2023-09-14 00:00:00 | 
| 2023-11-14 07:15:13.456 | today -2 month -1 day | 2023-09-13 00:00:00 | 
| 2023-11-14 07:15:13.456 | -1 day | 2023-09-13 07:15:00 | 
| 2023-11-14 07:15:13.456 | tuesday | 2023-11-07 07:15:00 | 
| 2023-11-14 07:15:13.456 | first | 2023-11-01 07:15:00 | 
| 2023-11-01 07:15:13.456 | first | 2023-11-01 07:15:00 | 
| 2023-11-14 07:15:13.456 | last | 2023-10-31 07:15:00 |