To read the article online, visit http://www.4GuysFromRolla.com/webtech/111299-1.shtml

Changing the Default Date Format
By Christopher Miller


When working with dates (such as using my event calendar article's script), it is often necessary to format it into the Web site's native languages format. For example, instead of mm/dd/yyyy, many languages use dd/mm/yyyy.

We can accomplish this by using the Locale ID (LCID) session property. By using this property, we can override the web server's default settings. The usage is below:

Session.LCID = 1043

The above code will set the LCID to Dutch format.

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 whatever format you are using).

Below is a table of the LCIDs, and the corresponding language that you have available:

LCID Language LCID Language
1078 Afrikaans 1052 Albanian
5121 Arabic(Algeria) 15361 Arabic(Bahrain)
3073 Arabic(Egypt) 2049 Arabic(Iraq)
11265 Arabic(Jordan) 13313 Arabic(Kuwait)
12289 Arabic(Lebanon) 4097 Arabic(Libya)
6145 Arabic(Morocco) 8193 Arabic(Oman)
16385 Arabic(Qatar) 1025 Arabic(Saudi Arabia)
10241 Arabic(Syria) 7169 Arabic(Tunisia)
14337 Arabic(U.A.E.) 9217 Arabic(Yemen)
1069 Basque 1059 Belarusian
1026 Bulgarian 1027 Catalan
3076 Chinese(Hong Kong) 2052 Chinese(PRC)
4100 Chinese(Singapore) 1028 Chinese(Taiwan)
1050 Croatian 1029 Czech
1030 Danish 2067 Dutch(Belgian)
1043 Dutch(Standard) 9 English
3081 English(Australian) 10249 English(Belize)
2057 English(British) 4105 English(Canadian)
9225 English(Caribbean) 6153 English(Ireland)
8201 English(Jamaica) 5129 English(New Zealand)
7177 English(South Africa) 11273 English(Trinidad)
1033 English(United States) 1061 Estonian
1080 Faeroese 1065 Farsi
1035 Finnish 2060 French(Belgian)
3084 French(Canadian) 5132 French(Luxembourg)
1036 French(Standard) 4108 French(Swiss)
2108 Gaelic(Irish) 1084 Gaelic(Scots)
3079 German(Austrian) 5127 German(Liechtenstein)
4103 German(Luxembourg) 1031 German(Standard)
2055 German(Swiss) 1032 Greek
1037 Hebrew 1081 Hindi
1038 Hungarian 1039 Icelandic
1057 Indonesian 1040 Italian(Standard)
2064 Italian(Swiss) 1041 Japanese
1042 Korean 2066 Korean(Johab)
1062 Latvian 1063 Lithuanian
1071 Macedonian 1086 Malaysian
1082 Maltese 1044 Norwegian(Bokmal)
2068 Norwegian(Nynorsk) 1045 Polish
1046 Portuguese(Brazilian) 2070 Portuguese(Standard)
1047 Rhaeto-Romanic 1048 Romanian
2072 Romanian(Moldavia) 1049 Russian
2073 Russian(Moldavia) 1083 Sami(Lappish)
3098 Serbian(Cyrillic) 2074 Serbian(Latin)
1051 Slovak 1060 Slovenian
1070 Sorbian 11274 Spanish(Argentina)
16394 Spanish(Bolivia) 13322 Spanish(Chile)
9226 Spanish(Colombia) 5130 Spanish(Costa Rica)
7178 Spanish(Dominican Republic) 12298 Spanish(Ecuador)
17418 Spanish(El Salvador) 4106 Spanish(Guatemala)
18442 Spanish(Honduras) 2058 Spanish(Mexican)
19466 Spanish(Nicaragua) 6154 Spanish(Panama)
15370 Spanish(Paraguay) 10250 Spanish(Peru)
20490 Spanish(Puerto Rico) 3082 Spanish(Spain - Modern Sort)
1034 Spanish(Spain - Traditional Sort) 14346 Spanish(Uruguay)
8202 Spanish(Venezuela) 1072 Sutu
1053 Swedish 2077 Swedish(Finland)
1054 Thai 1073 Tsonga
1074 Tswana 1055 Turkish
1058 Ukrainian 1056 Urdu
1075 Venda 1066 Vietnamese
1076 Xhosa 1085 Yiddish
1077 Zulu 2048 default

You can find the LCID values as assigned by Microsoft at http://www.microsoft.com/globaldev/reference/lcid-all.mspx.

Happy Programming!

  • By Christopher Miller


  • Article Information
    Article Title: Changing a Web Page's Default Date Format
    Article Author: Christopher Miller
    Published Date: Friday, November 12, 1999
    Article URL: http://www.4GuysFromRolla.com/webtech/111299-1.shtml


    Copyright 2017 QuinStreet Inc. All Rights Reserved.
    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers