Link to home
Start Free TrialLog in
Avatar of macdpa
macdpa

asked on

ASP VBScript UK Date Format Default

I want my ASP vbscript functions to always return dd/MM/yyyy british formats by default.

I have a page with the following code
<%
  response.write now()
%>
Sometimes it returns 11/6/2003 11:17:55 AM and sometimes 06/11/2003 11:17:42 (I also get the same scenario with currencies switching between £ and $ which suggests to me IIS switching Regional Settings). I can have the same page opened in separate browser windows within seconds of each other showing the different formats.

I have sifted through newsgroups for help, these are the things I have tried to no avail
*  The registry key HKEY_USERS/.Default/Control Panel/International is set correctly  (I understand that IUSR | IWAM account uses this)
* I remotely log on as Administrator. My regional settings are UK English, The Set Default is UK English (although it was US English).
* There are two other profiles under HKEY_USERS/ both of these have UK settings, as is the case with HKEY_CURRENTUSER
* I added a key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OLEAUT
VarConversionLocaleSetting = 2  and HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\InetInfo\Parameters SetVarConversionLocaleSetting = 2  which should force IIS to use system default Regional Settings

I have since rebooted, yet still the problem persists. I have even explicity set the Session.LCID = 2057 in the global.asa session and application startup events. However, I don't want a coding solution as I don't see why it should require one.

Server config is Windows2000 Advanced Server, Service Pack 4. IIS version 5.0

Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

YOu might want to consider using the LCID code at the top of your page:

http://www.webwizguide.info/asp/faq/date_time_settings.asp

Fritz the Blank
Avatar of macdpa
macdpa

ASKER

I have already tried using the Session.LCID = 2057 as follows in the global.asa to no effect

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

Sub Session_OnStart
      Session.LCID = 2057
End Sub

</SCRIPT>

Having it in the actual page does seem to have the desired effect. However as I stated in the original post, I wasn't wanting after a coding solution here. Perhaps its better suited to the IIS area ?
on your server, go to control panel --> regional date & time / language options (syntax will depend on your OS).

Change it there.  Then it will always be in UK format.

remember though, if someone from let's say the US is on the site and you have text fields where they type in the "date" you will have to take this into acount.
Avatar of macdpa

ASKER

This was the very first thing that I checked. As I say above I can only log on remotely (and do so as Administrator). Going through the control panel Regional Settings Dates are set as UK based.

I understand however, that IIS authenticates a web user as using the IUSR_ and/or IWAM_ accounts, and therefore I thought perhaps these accounts were set up with different regional settings. As these aren't real accounts you can't actually log in to these account and change their regional settings in the control panel like a normal user. So how do I check the regional Settings for these accounts ? As well as HKEY_USERS/.Default/Control Panel/International I checked the two other profiles that existed in the registry under the HKEY_USERS/ hive, they both have UK dates and locales settings specified.

 
I know that it wasn't what you wanted, but hey, if it works....

The idea is that IIS could serve many sites geared to different regions, so what you have in your control panel regional settings will not pertain.

I am at a loss as to why doing this in the global.asa  does not do it--for whatever reason, it appears that the pages don't inherit that property setting.

FtB
Avatar of macdpa

ASKER

That makes two of us, as soon as this problem came to my attention I went through and did the alterations to the global.asa in all the websites on the server. If I can help it I wish to avoid having to edit all the inidividual pages of all the websites affected.

We never use to have this problem it just appeared one day.

Paul.
ASKER CERTIFIED SOLUTION
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: fritz_the_blank {http:#9716579}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

vnvk
EE Cleanup Volunteer