Formatter Features: Date Formatting

  • 3 August 2021
  • 2 replies
  • 2966 views
Formatter Features: Date Formatting
Userlevel 7
Badge +11
  • Community Manager
  • 4564 replies

Welcome back, Zappers! This is our 5th installment in the Formatter Features series and today we’re going to be looking at how to use Formatter to alter date formats. Missed the first five? You can check them out here:

What We’ll be Covering

Fixing dates that are in the wrong format

Dates aren’t always sent from one app in a format that other apps are expecting, which can cause the day and month values to be swapped around!

Custom Date Formats

There may be times when the date format you need isn’t one of options available to select, so you’ll need to use custom date variables to create a custom date format.

Extracting the time from a date

Sometimes we’ll receive both a date and time value in a field, but we only need the time. With a Formatter step we reformat it to extract just the time.

Converting Unix timestamps into readable dates

Unix timestamps are a nice way for a computer to reference a date and time in seconds, but for us humans, they aren’t so easy to understand!

How to use Formatter to adjust date formats

Passing dates between apps that use different date formats can be tricky but Formatter is here to help with that! You can find it under Formatter by Zapier > Date / Time > Format:
e5fde6512503b004fe6c4e4fa322bdc9.png

Fixing dates that are in the wrong format

Ever see strange behaviour in your Zap where the day and the month are swapped around? This can occur when the date is being sent in a format that the app receiving it isn’t expecting. 

A good fix for this is to convert from the date its receiving to the date format it’s expecting. For example, change DD/MM/YYYY to MM/DD/YYYY.

To do that, in the To Format field you’d select the format that you want to change the date to (eg MM/DD/YYYY):

o3iow6oFscqGgjz9aK_y46UrO_9xZp10NrldUOYcszXl_dvOdMF4m8wpAgl-lBkdsjCZs4WgnjdDDlnx-v6bX80ZLGZ8mAyHFdIQXCNCi0oI6KYQvvsQTwxCQN2TyI0DAh4llXGL

And in the From Format field, you’ll select the format you want to change it from (eg DD/MM/YYYY):

K4uCglXcbjrVFP-eDRoACBIBjCOK8XpB72KILcHrXT8VmJZHonZjQP1n7UH68DVbvmW7pESot8MNkEIPIvdt0I2gJNLWOpEXhX4QtplLbAmLWLtisre70z4eN5DZTD8mHCoSSx0H

This would convert a date of 20/09/2021 into 09/20/2021:

xse3e5XMWKBIhhjrSOih0qNIAfOVlzv3wAPvsrYXVG2_rNP58jufzK7vh-fh7l1AifE99gOtMiJ6wwOfz9JNw8KhRTrxOGDcHQLz1MQXtfdaprvb6BTFkCdTY-YUYCG3pLTiUNJv

Custom Date Formats

Don’t see the format you want listed? You can select the Custom option from the dropdown menu and type in your own custom date format directly into the field:

Dk0euujsNIko63Zg3Lygn4CBtoWjtsWmklWK94VHpQFrQOSeqg0sqZ3_Ei1dHgeVDUYxakMagBZtCmNlFATKXIKdB__5G4xNmICUbHNFkyH7IdNCA7nSAGnwceqFDSjctQcNoGTl

You can see a full list of the custom date variables available to use in Date/Time custom value table. And you can read more about how to use a custom value in a Zap here: 
Add custom values to dropdown menu fields in Zaps

Extracting the time from a date

To remove a date from a field that contains both a date and a time, you’d first select the From Format that matches the format of the date in the Input field. Then use the Custom option to enter the desired time only format.

For example, if the input date was 2021-07-21T07:59:55+00:00 and we just wanted the time as 07:59, we’d use a custom date format of hh:mm in the To Format field:

1blzl0KNHkzTP2XdQDAzyQz5NxJ8E-_LXkPclO_25OWGpOd8UjRXB6fandlqRDmVBVgQUATOLHlwTwUNnNkKXt9Z5qdADYCW39461UAw20jm0t7w7sln-auR7Jl94YLajQBNXEVC

Then in the From Format field we’d select the YYYY-MM-DDTHH:mm:ssZ (2006-01-22T23:04:05-0000) format:

O7P0sW-WitrxiygkvSGx1hTEWDmO2kt2A4vQazXjD4p4qUWsDd8CuG4Qsfns4Ci_dMwj8rQWxoZ2BFak5RVT6t10vg_is6__bFsJmn_LzPQAy15VC-bI7cvlqSCL_UkZZDMEHDAS

That would then give us the time value only:

H2gKXiox_s8HaAVuLoW3iorUHC1oLna6y1Cg9NI4BWv0t7ixaO-OgSw2OmLCt8HJ7zMPjQacLMQ51q4WqPbXXoc8yVqnpsiOUNvbNpPKdmLSCUEZ306s9eOVKcE7eH5jm7Tdrihg

Converting Unix timestamps into readable dates

Sometimes an app will send dates as Unix timestamp. These will appear as a string of numbers like 1626854395

To convert a date from a Unix timestamp into a format that’s a bit easier to understand, like MM/DD/YYYY, you’d select the To Format of MM/DD/YYYY (01/22/2006):

SDGtsaFAKcBxUGwXe8x73dyjx0I0dM196gdYIZERKlc8D9CXPsjiwmSXPJU9dVcEb_qUi1YPDPqMvzzlcNTekE26EnpnCkhQ9E8iyr27LLHCbfDXfuDAJ6uC3w3FwEqnWNOfZwE3

Then select the From Format of X (1137971045):

EkpwGDIN27ifIaOLGphiTY7sM7Fgp3vCLeLoNSIf2zufb6KFH3hRBVKSvQXt-DSg2kmU3QndpJtsu_wHUT5LUszLh5Kx0zuo-BsDYgVMIIjkYgrX8RPwiRxGbUWhNdTCdAe9jkoc

That would convert a Unix timestamp of 1626854395 into 07/21/2021:

b4oP5V7ylJ3NP5RjqoRYgcT7tV9bg_V77FwRbUbhECCMByXaP87kn6J6eMMFrfY-T_oJNdRX4I62iLzkMYX-71_KcFoPLQV2rZgYaQgRkoLIFXJmNXfQlbGnnYmiM4pcKVxySEQZ

Things to Remember

Something to be mindful of is that Formatter will do it’s best to interpret the format it’s receiving the date in when a From Format isn’t selected, but it doesn’t always get it right. Be sure to select the correct From Format to ensure dates are interpreted correctly.

It’s also worth noting that when no timezone has been selected, Formatter will automatically assume that it needs to use UTC time. So if UTC isn’t what you’re using make sure you select the desired timezone on the To Timezone and From Timezone fields.

Other Resources

If you’re looking for more information, here are a few places you can look:

  1. Community articles
  2. Zapier’s help docs (here + here)
  3. This video from the first version of Zapier University 

Wrapping Up 

In our next article, we’ll be looking at how to compare dates together as well as how to add and subtract days using Formatter! :)


2 replies

“Date/time custom value table” link is broken

Any hint how to extract only Month MMMM value? Custom field does not accept only MMMM

Reply