Session.LCID (LOCALE ID)
Properly Formatting International Websites.
If you have developed international web sites, you had to format dates, numbers, currecy, etc.
yourself and relying on the version of Windows that was installed on the server was no good
idea in case you moved sites from say The United States to a United Kingdom provider.
With IIS4 and IIS5 (Windows NT4 and Windows 2000 respectively) you only need to set the LOCALE ID (Session.LCID )
and everything is done for you. The Session.LCID is a read/write property, meaning you can assign a value
to it as well as read its current value.
Session.LCID has session scope, which means you can just add one line of code to your global.asa file and ASP does
the rest for you. Just remember that if you assign a new value to the Session.LCID it will override global.asa and
will remain until a new value is set or the session is ended.
Below you can see locale id's for the US and the UK as well as how dates are formatted using these locales.
Session.LCID = 1033 'This is the English(United States) format.
Short Date : 8/25/2004
Long Date : Wednesday, August 25, 2004
Time : 4:29:53 AM
Currency : $9.95
Session.LCID = 2057 'This is the English(British) format
Short Date : 25/08/2004
Long Date : 25 August 2004
Time : 04:29:53
Currency : �10.00
When working with databases, you will want to also set the format of the date
field to correspond with the LCID that is being used in the script.
You can do this by going into the design view and setting the format to
dd/mm/yyyy or the format you are using.
Below is a table of the LCIDs, and the corresponding language that you have available:
You can click the Locale ID numbers below to display the following values formatted accordingly. Default is English(US)
Short Date : 8/25/2004
Long Date : Wednesday, August 25, 2004
Currency : $10.00
Time : 4:29:53 AM
LOCALE ID :
Send this article to a friend.
|