Workflow Example: Date Difference

This workflow demonstrates the basics of determining the difference between two dates (including dates & time or just time). The example begins with an example date and time against which to do our elapsed time comparison. The user is then prompted to enter a second date. If the Now option is selected, Workflow will use the date and time at that point. If Other is selected, Workflow will prompt the user for input but pre-populate it with the current date and time.

Whilst there is an option to prompt a user to enter the date and time with Ask for Input, if you opt for date & time granularity, only the day, month, hours and minutes are available. Nothing for specifying the year. As a result this example uses a text input and then pulls the date and time from that. Note that the maximum level of granularity is to the minute regardless of if you type in seconds or fractional parts of minutes.

With both dates entered, the Get Time Between Dates action is used to determine the difference. Here the units are specified as Total Time meaning it will give you a full break down of combined time units for the difference, but this could be set to be just seconds, minutes, hours, days, weeks or years. No option for months and slightly surprising that seconds appears given the level of granularity for entering the time.

Tags: | workflow |