Parse ISO date to get unix value (since epoch)

Hi,

I’m struggling with a date conversion.

To submit an entry to an API with a date field, the format required by the API is the unix time (elapsed time since epoch)
I have a source date in DD/MM/YYYY format. What would be the correct way ?
I’ve tried various ways using parsedate function, but couldn’t get anything that works.

Thanks!

Hi. Do this. Replace now for your datetime source

{{formatDate(now; “x”)}}

If you need additional support, please don’t hesitate to reach out.

Cheers
//Helio

1 Like

Yeah that was what I tried, but I’m not getting a unix value, but “1970-01-01T00:33:42.000Z” instead.

For reference, the output above is what I get with :
{{formatDate(“10/25/2023”; “x”)}}

EDIT: also adding that I’m getting the same result with
{{formatDate(“2023-03-23T19:50:39.847Z”; “x”)}}
, output is 1970-01-01T00:33:42.000Z when what I want is 1679601039

The same code you tried. See the images
image

image

If you need additional support, please don’t hesitate to reach out.

Cheers
//Helio

2 Likes

ok… my bad, I found my issue.
I was doing the formatdate on a “create JSON” and of course, I had the JSON field set to be “Date” type, so Make rewrites the unix back to ISO.

Switch it it to Integer and it works now.

BTW, is using Integer the “right way” for that format ?

1 Like