function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Localized formatted DateTime?

Hi All,


When the DateTime format method is used like this:


dateTimeValue.format('MMM-dd-yyyy - hh:mm a');


it returns a string like this: May-29-2010. The month name is in English. I've switched my Salesforce org to French, but the output is identical. I'd like to see something like this: Mai-29-2010 where the month is localized to French (Mai). Otherwise, French speaking users will see English month names and might get confused.


Is there anyway to localize the output of the DateTime.format method?


Thanks for your help.


Thanks for the link to the wiki. There is a lot of information there about Localization, but none of it is from the developer perspective. It appears that the API does not have localization built in. So I will have to 'roll my own' by doing some utility functions that will translate date strings.