I need formatting of date/time in this format:

set @date1 = Format(Now(),"YYYY-MM-DDThh:mm:ssZ")

Where as its not working and if I give like this - FormatDate(Now(),"YYYY-MM-DDThh:mm:ssZ"), only date is formatting.

Is there any other method where I can format time too?

I need the output format in GMT time i.e. it should be like this - 2018-10-24T06:44:37.000+0000. (yyyy-mm-ddThh:mm:ss.sssZ)


Please note that the 'HH' in the time part need to be in capitals if you want to use 24 hour notations. If lowercase 'hh' is used, SFMC will format the time to a '12 hour clock' hour.

set @date1 = Format("2019-12-16 14:24:56", "yyyy-MM-ddTHH:mm:ssZ") results in: 2019-12-16T14:24:56Z

set @date2 = Format("2019-12-16 14:24:56", "yyyy-MM-ddThh:mm:ssZ") results in: 2019-12-16T02:24:56Z


Did a quick test and apparently all that needed to be changed was the capitalization of the 'Y', the 'D' and the 'Z'.

Below worked for me:
set @date1 = Format(Now(),"yyyy-MM-ddThh:mm:ssz", "Date")

Which output:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.