Click to See Complete Forum and Search --> : vbscript <%now()%>
mrhutch
11-19-2001, 05:34 AM
UK date/time formatting properly
I have an ASP page, with a textbox with <%now()%> in to display the date...
on one box this displays an american format (11/19/2001) and on another I get UK (19/11/2001)
Both pages are identical, and run against IIS/SQL 2000 backends
I know that the locales on both boxes are fine - please help!
qball
11-19-2001, 07:21 PM
I know that the locales on both boxes are fine
What's a 'locale', a timezone?
Anyway, the problem is obviously setting/settings on each box. Check, Control Panel, Regional Settings, Date tab, on each box
But_Why
11-19-2001, 07:36 PM
Ive had that problem too.
Use the FormatDateTime function.
eg
FormatDateTime(Now,1)
where the 1 is a long date setup.
that way the months are words, and not mistaken.
for more info go here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctFormatDateTime.asp
Edit:
Changing the settings on each box would be crazy, cos if you have american visitors to your website then you don't want them to change their locales just for your website! :D
mrhutch
11-20-2001, 03:51 AM
cheers boys, but I've solved it!
I mentioned that we use SQL 2000 as a backend DB. Well, all the users on our intranet are set up as british UK locales (regional settings!) using NT domain authority, and connections to the SQL box(es) use trusted connections. It seems that the guy who originally built the SQL boxes used the installation defaults, and even if the NT Group(s) that the users belong to are set to English British, the DB server till takes Language ID 1 (english US) - which defaults date display as MDY instead of the (far superior :D ) DMY - this is SQL language ID 23..
phew.. now just have to get the SQL logins changed on all boxes... dang...
there is another fix.. simply putting a tag in the VB declaration in the header of the page to specify locale as a session variable but I think I'll have to go with changing the users - we also have american visitors from the offices over with you guys and because they are validated by NT on an american PDC, I would like thier dtes/times/money to display in a "familiar" way to them..
cheers again
Mr Hutch
mrhutch
11-20-2001, 04:04 AM
cheers boys, but I've solved it!
I mentioned that we use SQL 2000 as a backend DB. Well, all the users on our intranet are set up as british UK locales (regional settings!) using NT domain authority, and connections to the SQL box(es) use trusted connections. It seems that the guy who originally built the SQL boxes used the installation defaults, and even if the NT Group(s) that the users belong to are set to English British, the DB server till takes Language ID 1 (english US) - which defaults date display as MDY instead of the (far superior :D ) DMY - this is SQL language ID 23..
phew.. now just have to get the SQL logins changed on all boxes... dang...
there is another fix.. simply putting a tag in the VB declaration in the header of the page to specify locale as a session variable but I think I'll have to go with changing the users - we also have american visitors from the offices over with you guys and because they are validated by NT on an american PDC, I would like thier dtes/times/money to display in a "familiar" way to them..
cheers again
Mr Hutch
SysOpt.com
Copyright Internet.com Inc. All Rights Reserved.