home navigator pointer resources navigator pointer asp tips navigator pointer locale date settings
The definitive ASP tips page
tips menu | printable single page version

Note: this is my old ASP tips page and is no longer supported. See the new Visualize web site..

IIS/NT Tips - Locale Date Settings

If you're lucky enough to be setting up an IIS NT4 server from scratch, then it's important to get settings such as the locale/regional set up correctly very early on, before ASP scripts are developed on them, as they can effect how scripts behave, particularly those which rely on system date/time information. Anyway, to cut a long story short, log on locally as administrator and check that the regional settings are as expected. In particular, check that the Short Date setting is as you require. For example, in the UK, we would typically want the short date format to show as dd/mm/yyyy, but the default is US format with a two digit year (ie m/d/yy). This can create havoc with scripts which use the ASP date() function which uses the locale setting for its formatting (writing your own date component would be one way of tackling this issue).

Make sure that you also change the regional settings for IUSR_machine etc. as well. There are two ways of doing this, either by logging on as each in term (you will need to set or know the passwords), or by searching/editing the registry for sShortDate and modifying them directly (only do this if you are confident with regedit!).

Check also that NT's roaming profiles do not affect the date settings when other users log on to the machine (simply write a short ASP script which displays the result returned from date(), keep refreshing the page while other users log-on to the server, and see if the date format changes). If the users are set up correctly, it shouldn't.

There also appears to be a bug in NT4 SP3 and IIS4. Despite changing all occurrences of ShortDate in the registry, the date format that you specify does not appear to take effect after a fresh reboot. It only works once at least one user has logged onto the machine and off again. Strange... if someone knows the answer to this, please drop me a line....

If you're still having problems, you should also try adding "Session.LCID = 3081" (eg is for UK) in the script. You can also use this approach to use the user's browser language settings captured from the HTTP header info. See this Microsoft Multi-language Support KB article for more details. This also contains the codes for other countries.

 

DISCLAIMER: Note these pages are a free resource for anyone wishing to reference them. Although every care is taken to ensure their correctness, the author takes no responsibility for any errors or problems that may occur through their use, or indeed misuse. These pages are copyight of Dave Clarke, Visualize Software Ltd 1997-2000 (all rights reserved).


 


© Copyright Dave Clarke, 1996-2008