adOpenStatic Logo
Ken's Blog
Contact Ken
Copyright 2000 -

Setting the date format used by ASP
People often why code like the following:


produces a date format different to that they have specified in their Regional Options/Settings control panel.

The answer is usually because the settings that you set in the Regional Settings control panel are for the logged on user only. On the other hand, IIS (and hence in-process ASP) runs under the local system account (like most services). To get ASP to use the same date format as the logged on user you need to change the settings for the local system account.

Changing the settings in WinXP
Open the "Regional and Language Options" control panel. On the "Regional Options" tab set the locale you wish to use. Press the advanced button if you wish to change any of the default formats for your locale. Then, click on the Advanced tab and check the box at the bottom that it labelled "Apply all settings to the current user account and to the default user profile"

Setting the Default Locale under Windows2000

Changing the settings in Win2k
Open the Regional Options control panel. On the general tab, press the "Set Default" button. Select the appropriate locale, and clck "OK" twice to exit the control panel. Windows will advise you that the changes will take effect after the next reboot.

Setting the Default Locale under Windows2000

Changing the settings in WinNT v4
Open the Regional Settings control panel. Set the locale to be one your wish to use. Check the box that is labelled "Set as System Default Locale...". Press OK to exit the control panel. You will probably need to supply your WinNT installation media and then reboot. Following the reboot, reapply Service Pack 6a

screen shot for WinNT coming soon.

A final note
Whilst not entirely related, the following MS KB article demonstrates ASP code that will set the Session.LCID of a page dynamically based on the browser's Accept-Languages HTTP header: Q229690. Thanks to Andrew Haslett and others who emailed this in to me.

Back to FAQ Listing