Solved

ASP VBScript UK Date Format Default

Posted on 2003-11-10
9
575 Views
Last Modified: 2012-08-14
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

0
Comment
Question by:macdpa
9 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9714795
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
0
 

Author Comment

by:macdpa
ID: 9715492
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 ?
0
 
LVL 2

Expert Comment

by:turbosig
ID: 9715886
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.
0
 

Author Comment

by:macdpa
ID: 9716217
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.

 
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9716263
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
0
 

Author Comment

by:macdpa
ID: 9716530
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.
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 125 total points
ID: 9716579
>>If I can help it I wish to avoid having to edit all the inidividual pages of all the websites affected.<<

Boy, oh boy, do I hear you!

I generally have header and footer include files on my pages. That way, if I need a global change, I can just make one modification.

It is a strange thing, and I can't speak with authority here, but it seems that global.asa files can interfere with each other when you have a main site with a series of virtual directories under it.

By and large, this is why I rarely use the global.asa--the Session  On End has never worked well, and most of what I want to do with the Session On Start can be done with an include file.

FtB

0
 
LVL 7

Expert Comment

by:vnvk
ID: 12046225
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
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now