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.

commanddescription
todayWill pick the trigger_date of the job and truncate it to the day (sets the hours, minutes and seconds to zero).
yesterdayWill pick the trigger_date of the job, truncate it to the day (sets the hours, minutes and seconds to zero) and subtract one day.
tomorrowWill 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_hourWill pick the trigger_date of the job and truncate it to the hour (sets the minutes and seconds to zero).
mondayLast complete Monday.
tuesdayLast complete Tuesday.
wednesdayLast complete Wednesday.
thursdayLast complete Thursday.
fridayLast complete Friday.
saturdayLast complete Saturday.
sundayLast complete Sunday.
firstFirst day of the current month. It will be today if it is the first of the month.
lastLast day of the previous month.

Adding and subtracting time frames

commanddescription
+ 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_daterelative dateresulting date
2023-11-14 07:15:13.456today2023-11-14 00:00:00
2023-11-14 07:15:13.456-1 hour2023-11-14 06:15:00
2023-11-14 07:15:13.456today -1 day2023-11-13 00:00:00
2023-11-14 07:15:13.456today -2 month2023-09-14 00:00:00
2023-11-14 07:15:13.456today -2 month -1 day2023-09-13 00:00:00
2023-11-14 07:15:13.456-1 day2023-09-13 07:15:00
2023-11-14 07:15:13.456tuesday2023-11-07 07:15:00
2023-11-14 07:15:13.456first2023-11-01 07:15:00
2023-11-01 07:15:13.456first2023-11-01 07:15:00
2023-11-14 07:15:13.456last2023-10-31 07:15:00