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
KruviKruvi 

User/Company Locale Date format

Hi 

 

I need help in retrieving the User/Company locale date format in Visualforce (or APEX).

For example: dd/mm/yyyy or mm/dd/yyyy

 

Thanks in advance :-)

Navatar_DbSupNavatar_DbSup

Hi,

 

OutputField will display the date according to the user's time zone.  OutputText or free tag expressions will be shown in GMT.

Example:

 

<apex:page>

   <apex:outputText value="The unformatted time right now is: {!NOW()}" />

   <br/>

   <apex:outputText value="The formatted time right now is:

         {0,date,yyyy.MM.dd G 'at' HH:mm:ss z}">

 <apex:param value="{!NOW()}" />

   </apex:outputText>

</apex:page>

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

KruviKruvi

Thanks but I need the format so I can pass it to a JS calendar component I'm using, so the calendar will display the date in the correct date locale...

 

Any suggestions?