Documentation

Your guide to everything Workflow.

Understanding date and time formatting

Taking control of your calendar and the date information included in your events is a powerful way to use Workflow. While building workflows, you may encounter situations where you want to format a date into text. Workflow offers a Format Date action for this purpose. Additionally, date and time formatting can be set within a variable.

In this article, we’ll review the formatting options provided in Workflow. If you’d like, you can download this sample workflow and try out the different date formats as you go along.

Short, Medium, and Long

The most convenient and simple date formats in Workflow are Short, Medium, and Long. Choosing Short will show only numerical values in the result, displaying as 6/1/17. Medium shows the three-letter version of the month and doesn’t use slashes, displaying as Jun 1, 2017. Long shows the full text of month’s name, displaying as June 1, 2017. Or, you can set the date format to None which will exclude date information from the result and only show the time.

Separately, you can choose a format for the time of day: Short, Medium, or Long. Short will show the time in the most familiar way, displaying as 2:41 PM. Medium will add seconds, displaying 2:41:36 PM. Long will add seconds as well as the time zone, displaying as 2:41:36 PM PST. Setting the time format to None will exclude time information from the result.

Note

The results shown above for each format are specific to English and may vary by locale.

Dates as written language

The date format How Long Ago/Until is useful for gathering a simple description of how long ago or how far into the future a date is relative to now. The result is based on the most significant component of the time period, producing results like 43 minutes ago, 19 hours from now, 5 days from now, or 3 months ago.

Similarly, the Relative date format allows you to choose from helpful shortcuts like Yesterday, Today, and Tomorrow. These options are relative to the current date and time at the time the workflow is run.

Technical standards

Workflow also has support for standard formats like ISO 8601 and RFC 2822 that are used for more technical purposes.

With ISO 8601, the date portion follows the format YYYY-MM-DD, displaying as 2017-06-01. If an ISO time is included, the time and time zone are appended to the date after a T designator, displaying as 2016-06-01T14:41:36-08:00.

Note

The ISO 8601 format is particularly helpful for keeping dates in order, as a list of ISO 8601 dates displays in chronological order when the files are sorted alphabetically from A-Z.

RFC 2822 is an Internet Message Format use to uniformly represent date and time, including in HTTP and email headers. RFC 2822 includes the shortened day of week, numerical date, three letter month, year, time, and time zone. All together, this displays as 01 Jun 2016 14:31:46 -0700.

Note

RFC 2282 is hardly used outside the Internet – if you don’t already know what it is, you likely don’t need it. Learn more about the standard here.

Custom formats

Despite all of the predefined date formatting options, you might find yourself wanting to craft a format more specific to your needs – for that, there’s the option to add a Custom pattern. When you select Custom formatting, you’ll be provided with an additional text field to enter a Format String, which consists of a pattern of special characters.

For custom format strings, Workflow uses patterns defined by the Unicode Technical Standard #35. See Date Format Patterns for full documentation.

A summary of example format strings and their results are shown below:

Pattern Result
yyyy.MM.dd G 'at' HH:mm:ss zzz 1996.07.10 AD at 15:08:56 PDT
EEE, MMM d, ''yy Wed, July 10, '96
h:mm a 12:08 PM
hh 'o''clock' a, zzzz 12 o'clock PM, Pacific Daylight Time
K:mm a, z 0:00 PM, PST

Pro Tip

Custom patterns can include special characters like . or / in between the date characters. You can also include text of your choosing in these custom patterns by placing single quotes around the string. See the first example in the table above where the word 'at' is inserted inline.

To view the complete set of custom date format characters, view the Date Field Symbol Table included in this workflow or view the full Unicode #35 standard.