Dates and Times are a common challenge to anyone working to interconnect different cloud-based applications. Many applications settle on their own “default” format for times and dates, thus conversions are inevitable! In this module we’ll go into more detail on how to affect great outcomes with dates and times in your Flows!


Course Material


Dates and Times are a common challenge to anyone working to interconnect different cloud-based applications. Many applications settle on their own “default” format for times and dates, thus conversions are inevitable! In this module we’ll go into more detail on how to affect great outcomes with dates and times in your Flows!

Overview

Dates and Times are a common challenge to anyone working to interconnect different cloud-based applications. Many applications settle on their own “default” format for times and dates, thus conversions are inevitable!

For instance, Salesforce may have a default date format of “YYYY-MM-DD”, but Wrike may use “MM/DD/YYYY”.

As a result of these differences, knowing how to handle dates and times is key in Flow-gramming.

Date Cards

Quite a number of cards are available for working with dates and times! The list below details the most common Date and Time cards. Within the application, details on how each date card works may be found by clicking the “?” icon at the bottom left of all cards. Links are provided below as handy reference:

Card Description
Add Add a multiple of some unit of time (e.g. seconds) to a starting date, returning the resulting new date.
Date to String Format a date into the format specified by an input string and input timezone
Difference Return the difference between two date objects.
Epoch Return the unix epoch timestamp of a date object (seconds since unix epoch).
From ISO String Convert from an ISO string to a set of other date formats: ISO, Unix (Epoch), Unix (MS), natural language, and an optional custom format.
ISO Return the corresponding iso8601 string of a date object.
Now Return the current time.
String to Date Create a date object from the contents of a string.
Subtract Subtract a multiple of a unit of time (e.g. seconds) from a starting date, returning the resulting date.
UNIX Return the Unix timestamp of a date object.

Also very important here is to make sure that fields you’re working with can accept a date object.

Working with Dates - Key Examples

We recommend doing the exercises in the workbook to help secure your understanding of how dates work. Below are key points that you should understand in working with dates and times.

The Now Card

Now is extremely useful in working with dates and times as it gives you a large array of date/time information - in various formats. The Now card will return the date/time information for the moment in which the Flow was executed.

Note that you can click “Test this Card” and quickly get at a list of all the outputs this has to offer!

The Date to String Card

The Date to Text card formats a date and time into a provided format in a specified timezone. You can drag a date from the Now (or other) card into the “start” field, apply a format for the date output and even work with time zones.

Date input fields will do their best to convert whatever you pass into them.

For this card, you should reference the in-app help to understand how best to work with Format Codes. This information can be accessed easily by clicking the “?” icon at the bottom of the card.

Adding, Subtracting, and Calculating Differences Between Dates

Commonly, working with calculations around dates is a complex process. Various cards we offer can often simplify these calculations.

Add and Subtract cards take a start date as input (drag and drop from the Now or other card) and calculate a change based on the scale - the number of the count of a unit of measure, and the unit of measure itself (such as days or weeks)

PRO TIP: Note that you can change the name of the output field to make it easier on yourself to work with! For example, by clicking on the gear icon in the bottom right of the card and clicking “Edit card” provides access to edit the fields

The Difference card will accept start and end dates and - like the outputs found on the Now card - give you an array of outputs to use elsewhere.

Working with Strange Date Formats

When you have a peculiar date format, it’s often good to leverage the Text to Date.

This card lets you bring in a date with a strange format. In other words, where the conversion logic is non-standard or may be ambiguous.

For example, what if you have a date in this format: “YYYYMMDD”. This may be odd because it’s missing hyphens (-) or slashes (/) so many applications may not know what to do with it. By adding in the format you expect, you can then translate into whatever format you need - quickly and efficiently!

Designer will automatically attempt to convert strings to date and time as needed with this card, so in the above case you can see this being converted to a standard ISO format if we don’t provide any particular format.

Summary

Working with Dates and Times can be tricky, but the cards we feature are powerful and can address most any use case.