Expand my Community achievements bar.

SOLVED

Display French date in email

Avatar

Level 3

I am trying to use this code:

{% let d = now %} 
{% let frMonths = ["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"] %} 
{% let month=getMonth(d)%} {{frMonths}} {%= formatDate(d, "dd, YYYY") %}

 To output the current date in French as below:

mars 28, 2023

 

But what I am getting back when I simulate content is:

List(janvier, février, mars, avril, mai, juin, juillet, août, septembre, octobre, novembre, décembre) 28, 2023

 

Does anyone know how I can achieve just the "mars" in the Month section?

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi, I have done something similar using an IF statement. Hope this could help

 

{% let d=now %}
{% let m=getMonth(d)%}
{% let frMonths=""%}
{%#if m=1 %}
{% let frMonths="janvier"%}
{% else if m=2 %}
{% let frMonths="février"%}
{% else if m=3 %}
{% let frMonths="mars"%}
{% else if m=4 %}
{% let frMonths="avril"%}
{%/if%}

{{frMonths}} {%= formatDate(d, "dd, YYYY") %}

View solution in original post

3 Replies

Avatar

Correct answer by
Level 2

Hi, I have done something similar using an IF statement. Hope this could help

 

{% let d=now %}
{% let m=getMonth(d)%}
{% let frMonths=""%}
{%#if m=1 %}
{% let frMonths="janvier"%}
{% else if m=2 %}
{% let frMonths="février"%}
{% else if m=3 %}
{% let frMonths="mars"%}
{% else if m=4 %}
{% let frMonths="avril"%}
{%/if%}

{{frMonths}} {%= formatDate(d, "dd, YYYY") %}

Avatar

Level 3

Thank you! This worked.

Do you have an online resource regarding the PQL language for use in AJO?