Converting English Months to French in ACC | Community
Skip to main content
Level 3
July 21, 2020
Question

Converting English Months to French in ACC

  • July 21, 2020
  • 3 replies
  • 3722 views

hey!

First run at ACC here, and trying to convert the current date into French months:

 

<%= formatDate(new Date(), "%D %Bi %Y") %>,

 

So instead of 20 July 2020, i would it to say 20 juillet 2020

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

Manoj_Kumar
Community Advisor
Community Advisor
July 21, 2020

Hello @connorslack24 ,

 

You can use moment.js in your workflow to achieve this.

 

Just download the moment.js library (from here). Then upload it in Administration > Configuration > JavaScript Codes

 

Then in your workflow you can use this code.

loadLibrary('NAMESPACE:moment.js'); var myDate=formatDate(new Date(), "%D %Bi %Y"); var frenchDate=moment(myDate, 'DDD MMMM YYYY', 'fr');

More Information on date formatting is available here: https://momentjs.com/docs/#:~:text=moment(%2212%2D25%2D,valid%20dates%20over%20invalid%20ones.

Let me know if that works.

Manoj  | https://themartech.pro
Level 3
July 22, 2020
Thank you! As i dont have access to admin panel yet, I cannot try this but i have asked my admin to load it.
Jonathon_wodnicki
Community Advisor
Community Advisor
July 22, 2020

Hi,

 

Use toLocaleDateString().

 

Thanks,

-Jon

Level 3
July 22, 2020

Hey Jonathon, Thanks!
Hey! My problem is the correct syntax, as i am new to eJS (coming from Freemarker) i cant seem to get it right:

 

<%= formatDate(toLocaleDateString('fr-CA), "%D %Bl, %Y") %>

 

Doesnt seem to work, but chances are im not coding it correctly.

Sukrity_Wadhwa
Community Manager
Community Manager
July 28, 2020

@_manoj_kumar_ @jonathon_wodnicki Can any of you further help with @connorslack24 's query?
Thanks!

Sukrity Wadhwa