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
AndrewTaylorAndrewTaylor 

Datetime.format - Support Language?

I have an Apex routine that generates a formatted date for an Event, e.StartDateTime.format('MMM d, YY').

When logged in as a French user, the Month format is not changed to a French abbreviation.  Is there a way to accomplish this?

 
Zuinglio Lopes Ribeiro JúniorZuinglio Lopes Ribeiro Júnior
Hello,

If you are displaying this Date (i.e. in a Visualforce) , you can use e.StartDateTime.format(). It converts the date to the local time zone and returns the converted date as a formatted string using the locale of the context user. 

https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_datetime.htm#apex_System_Datetime_format (https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_datetime.htm#apex_System_Datetime_format" target="_blank)

Regards.

Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
AndrewTaylorAndrewTaylor
Thanks for the reply Zuinglio; however, the language is not being supported.

In the Apex Class, I've turned on debugging, and see the language is "fr", but the month still renders in English (e.g. "Feb" instead of "Fév").

Any thoughts?
Zuinglio Lopes Ribeiro JúniorZuinglio Lopes Ribeiro Júnior
Hello,

Is the user properly configured? Make sure you have the user's locale configuration with the right settings.

User-added image

Regards.

Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
AndrewTaylorAndrewTaylor
Yep, its configured to French language, locale of French (Canada).
Ramón MuñozRamón Muñoz
Almost three years later and this still does not work. @aj2taylo2010, did you ever find a workaround?
AndrewTaylorAndrewTaylor
@Ramon, I don't have access to the org anylonger, so pulling from memory, but I think we ended up creating our own method to build out the string, and had a map for the French short-form of the month.