Not able to format this date

Hey guys, I am trying to format a date and I am getting an error saying its not a proper date or something


This is the function I used

formatdate ( `November 29th, 7:40am`; M/D/YYYY h:mma ; America/New_York)

Why am I getting error messages here with this formula

Hi @Fahad_Sheji The formatDate function expects a variable of type text. What you are providing there is a string.
You would have to use parseDate function to first transform the string into date, than use format date.

2 Likes

To complement Tiberiu’s answer. You can always see the type of the variable from another module when you hover over it:

image

If it’s a text, we need to Parse it first. And then we can reformat it.

This should work:


{{formatDate(parseDate(`November 29th, 7:40am`; "MMM Do, HH:mm a"; "America/New_York"); "M/D/YYYY h:mma "; "America/New_York")}}
3 Likes

wow, @makeitfuture & @NolaDigital I was always doing this through trial & error :smiley: I didn’t know I can find out this way! Thank you :pray:

2 Likes

Thanks, btw I would like to know what does adding the time zone at the end do.

Are we telling the system that “format the date in this way and make it into this time zone’s time” or are we telling them that “format the date in this way and this is the time zone of the input date”

the time zone option will return the date in the time zone you define. The input time zone is defined by your account settings.

1 Like

What if the input time varies based on the time zone of the lead, how can I tell MAKE that this is their time zone and I want them in this format.

PS: I have this problem with an automation regarding calendly where I am supposed to add the date and time slot they booked into a sheet but this date depends on which time zone they set in calendly.

I would set a variable and do some testing until the result matches the expectations. If the time zone need to be dynamic based on some calendly input use a switch function or module.

1 Like

how should I use the switch function for this instance