Attempting to convert timestamp variable to UNIX

Hey!

I am attempting to simply convert this timestamp variable into UNIX format in order to be passed to an API request.

looking at the Make Docs it appears there are solutions for converting from UNIX but I don’t seem to see anything for converting TO UNIX hoping for a little guidance in understanding how I can get this done.

Thank you!

Currently my “Timestamp” is coming in as M/D/TIME - ex. March, 27th, 2024 2:12PM.

I am attempting to convert this into UNIX just to clarify.

Thanks in advance for any help!

If your timestamp is coming in as a string of text, you need to Parse it with parseDate() first:

image

This turns it into a proper date format. Which you can then use with formatDate() to turn into Unix:
image

Or merged into one:
image
image

3 Likes

Hey Nola,

Thank you so much for taking the time to respond and provide this information. Am I able to instead pass the timestamp as a variable instead? like so -

I attempted this and it doesn’t appear to be running the conversion on it.

Yes

That’s because you are not using the correct format. In particular, I think you missed out a space after each of the commas.

2 Likes

Hey Samliew,

Thanks for your reply, I attempted to adjust the format based on your comments however I still have been unable to get this conversion to run correctly. It seems the value from my timestamp variable isn’t being grabbed, do I need to extract that and pass it in a different way? Here are some screenshots for reference.



Just to provide some more context, the Webhook is what’s supplying the Timestamp which is getting passed along to my set variable tool. Feel like I may be missing a step here.

If you hover over your 12. Timestamp variable. Does it show as text or date?

image

Also, could you perhaps share a (cleaned) version of the webhook output?

2 Likes

Ah I see, it’s coming in as “date” no wonder the formatting wasn’t running as anticipated I assume there’s a different manner for dealing with date. Sorry pretty new to working with Make still learning!

This is what the webhook output is looking like

Alright! If it’s a date field, you’ll have to use formatDate() instead of parseDate()

so that would then be:

image

2 Likes

My hero! Thanks so much.

3 Likes