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

1 Answer 1

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .