Classic ASP Changing, Date, Time, and Currency Format

Programming, error messages and sample code > sample code
If you are using a hosting company in another country, is how to change the date, time, and/or currency format to their own or international format. 

Well, you'll be glad to know that this is relatively simple to do.


If you can run a global.asa file on your server then place the following into your global.asa file to change the locale settings throughout your site: -
 
     
  'When a session starts on the server the following code will be run
Sub Session_OnStart

     'Set the server locale
     Session.LCID = 2057

End Sub
 
     

If you can not use a global.asa file, place following into the top of each ASP page you wish to change the locale settings on: -
 
     
  <%
'Set the server locale
Session.LCID = 2057
%>
 
     

The LCID number above, 2057, will set the locale settings on the server to United Kingdom English, to change the locale to your own country you will need to use the LCID Chart at the bottom of this page to find your own locale ID number and then replace 2057 with your own LCID number.

Please also be aware that your locale language files needs to be installed on the server, many severs will have multiple language files installed, but if you do select one that is not installed you may get the following error 'the specified LCID is not available' if you do you may need to contact your hosting company to persuade them to install your language files on there servers.

Please note that this will only change the format the dates, times, and currencies are shown in and will not move dates and times to another time zone. eg. mm/dd/yyyy to dd/mm/yyyy.
 
 LCID Chart
   
 
Locale Description LCID Locale Description LCID
Afrikaans 1078 Icelandic 1039
Albanian 1052 Indonesian 1057
Arabic - United Arab Emirates 14337 Italian - Italy 1040
Arabic - Bahrain 15361 Italian - Switzerland 2064
Arabic - Algeria 5121 Japanese 1041
Arabic - Egypt 3073 Korean 1042
Arabic - Iraq 2049 Latvian 1062
Arabic - Jordan 11265 Lithuanian 1063
Arabic - Kuwait 13313 FYRO Macedonian 1071
Arabic - Lebanon 12289 Malay - Malaysia 1086
Arabic - Libya 4097 Malay – Brunei 2110
Arabic - Morocco 6145 Maltese 1082
Arabic - Oman 8193 Marathi 1102
Arabic - Qatar 16385 Norwegian - Bokmål 1044
Arabic - Saudi Arabia 1025 Norwegian - Nynorsk 2068
Arabic - Syria 10241 Persian (Iran) 1065
Arabic - Tunisia 7169 Polish 1045
Arabic - Yemen 9217 Portuguese - Portugal 2070
Armenian 1067 Portuguese - Brazil 1046
Azeri - Latin 1068 Raeto-Romance 1047
Azeri - Cyrillic 2092 Romanian - Romania 1048
Basque 1069 Romanian - Moldova 2072
Belarusian 1059 Russian 1049
Bulgarian 1026 Russian - Moldova 2073
Catalan 1027 Sanskrit 1103
Chinese - China 2052 Serbian - Cyrillic 3098
Chinese - Hong Kong SAR 3076 Serbian - Latin 2074
Chinese - Macau SAR 5124 Setsuana 1074
Chinese - Singapore 4100 Slovenian 1060
Chinese - Taiwan 1028 Slovak 1051
Croatian 1050 Sorbian 1070
Czech 1029 Spanish - Spain 1034
Danish 1030 Spanish - Argentina 11274
Dutch - the Netherlands 1043 Spanish - Bolivia 16394
Dutch - Belgium 2067 Spanish - Chile 13322
English - Australia 3081 Spanish - Colombia 9226
English - Belize 10249 Spanish - Costa Rica 5130
English - Canada 4105 Spanish - Dominican Republic 7178
English - Caribbean 9225 Spanish - Ecuador 12298
English - Ireland 6153 Spanish - Guatemala 4106
English - Jamaica 8201 Spanish - Honduras 18442
English - New Zealand 5129 Spanish - Mexico 2058
English - Phillippines 13321 Spanish - Nicaragua 19466
English - South Africa 7177 Spanish - Panama 6154
English - trinidad 11273 Spanish - Peru 10250
English - United Kingdom 2057 Spanish - Puerto Rico 20490
English - United States 1033 Spanish - Paraguay 15370
Estonian 1061 Spanish - El Salvador 17418
Farsi 1065 Spanish - Uruguay 14346
Finnish 1035 Spanish - Venezuela 8202
Faroese 1080 Sutu 1072
French - France 1036 Swahili 1089
French - Belgium 2060 Swedish - Sweden 1053
French - Canada 3084 Swedish - Finland 2077
French - Luxembourg 5132 Tamil 1097
French - Switzerland 4108 Tatar 1092
Gaelic - Ireland 2108 thai 1054
Gaelic - Scotland 1084 Turkish 1055
German - Germany 1031 Tsonga 1073
German - Austria 3079 Ukrainian 1058
German - Liechtenstein 5127 Urdu 1056
German - Luxembourg 4103 Uzbek - Cyrillic 2115
German - Switzerland 2055 Uzbek – Latin 1091
Greek 1032 Vietnamese 1066
Hebrew 1037 Xhosa 1076
Hindi 1081 Yiddish 1085
Hungarian 1038 Zulu 1077