Print this page

"inputfield" displaying wrong date format on VF page on Site

Knowledge Article Number 000187671
Description While accessing the VF page using Site with Site Guest User, the Date format on "inputfield"  is not according to the locale of the Site Guest User. 

For example:-

As per the following article: 
How to change the date format for each User

 If the Site guest User has the locale as English-UK   so the "inputfield" for date should show the UK format which is DD-MM-YY, however it shows as MM-DD-YY.

For site Guest User it is using the Browser's Language Locale instead of the Site guest User's Locale. 

Note :- If you change the Browser Language, it will automatically change the Format of Date "inputfield". 

You can try changing it on Internet explorer>>General>>Language>>"Select language". 

The VF  works fine for any other Salesforce platform  user and collecting the correct locale.

For example if you login as System admin then the Vf page will show the correct Date format according to the locale of System admin user. 
Resolution To add a locale to the Vf page you need use the language attribute of Vf page. 

It will use the locale according to the VF page language. 

For example <apex:page  language[="en_GB">  will  use the UK- English locale and display the Date format as DD-MM-YY on Inputfield. 


promote demote