Best answer

How to convert Date from Airtable field to be added to a JSON data in Zapier Webhook?

  • 18 August 2020
  • 4 replies
  • 317 views

Userlevel 2

Hello friends! 

I want to send an API request and need to include date in the DateTime format. I am not sure what does that mean, but let me know if Zapier formatter can convert a date into this format? Or is there any alternative? 

icon

Best answer by colbyhemond 19 August 2020, 14:30

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 1

@admin_speakeasy

It looks like there’s a handful of DateTime formats that Zapier’s formatter can translate the date into:

https://zapier.com/help/create/format/modify-date-formats-in-zaps#customize-date-time-options

Does the API you’re trying to use have documentation that explains which format it is expecting?

Userlevel 2

Thanks @COLEMANSAM, didn’t notice this in formatter. From their docs, this is the only mention i have seen.
 


I’m sending a JSON payload in this format.
 

curl https://app.snipcart.com/api/discounts \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-u {YOUR_API_KEY}: \
-d "{ name: 'Free shipping',
trigger: 'Total',
totalToReach: 150,
type: 'Shipping',
shippingDescription: 'Free shipping',
shippingCost: 0,
shippingGuaranteedDaysToDelivery: 10 }"
Userlevel 1

@admin_speakeasy I would try formatting the date into the following format for SnipCart to accept it:

YYYY-MM-DDThh:mm:ss.SSSZ

Here is an example I found from a different page of the SnipCart docs:

2016-05-25T21:21:27.213Z

It doesn’t appear that Zapier offers this format as one of their predefined options, so you can just click on the “Custom” tab and paste YYYY-MM-DDThh:mm:ss.SSSZ in order to use that format.

Hope this helps!

Userlevel 2

Thanks @colbyhemond Tha worked flawlessly 🙂