4

I followed this question/Answer to format date in French: AMPscript Date Formating for French Language in HTML emails

Following this post, I would like to know how we should add the time to the date in French to get this result: "4 novembre 2019 à 16h30" ("à 16h30" means "at 4:30PM").

I tried the code below. It seems to almost work, but I am not sure about the syntax, especially the "h" I add for "16h30"... it could be interpreted as the time/hour to display.

And also, for getting the MINUTES, I used mm (m in lowercase) but it seems that it displays the MONTH (11 / november) because when I refresh my tests, it never changes and the minutes stay on 11...!

I used the following code :

%%[
VAR @today 
SET @today = SystemDateToLocalDate(Now(1))
]%%

Inside the email body :

%%=FormatDate(@today,"d MMMM yyyy à HH'h'mm",,"fr-CA")=%%

Output : 4 novembre 2019 à 15h11 4 novembre 2019 à 16h11

Thank you

Regards

Ludivine

3

Try this code:

%%[
VAR @today 
SET @today = SystemDateToLocalDate(Now(1))
]%%

%%=FormatDate(@today,"d MMMM yyyy à ", "HH'h'mm","fr-FR")=%%

The FormatDate function takes up to 4 parameters. The parameter number 2 stands for the Date format pattern. The Parameter number 3 stands for your Time format pattern.

I've just added a comma to separate the Date and Time patterns.

Reference

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/FormatDate.htm

  • Thank you very much! it works perfectly :) – Ludivine L Nov 5 '19 at 9:42
  • No worries Ludivine, don't forget to accept the answer so it will be easy for others to identify it.. – Rachid Mamai Nov 5 '19 at 9:43

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.