+ Start a Discussion

User/Company Locale Date format



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 :-)




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




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


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

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

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




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



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?