Solved

ASP VBScript UK Date Format Default

Posted on 2003-11-10
9
579 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

896 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

14 Experts available now in Live!

Get 1:1 Help Now