|
 |
asp_web_howto thread: British / US Date display
Message #1 by m.murray@s... on Tue, 16 Apr 2002 15:09:39
|
|
Hi there
Both my webserver & webhost run SQL Server 7. One of my ASP pages displays
a date - but they display differently on the servers.
On my webserver it displays as 25/4/02 (British dd/mm/yy)
but on my webhost it displays the American way 4/25/02 (American mm/dd/yy)
Has anyone written a function to display the date the British way??
HELP!! It's driving me nuts!
Cheers in advance
Matt
Message #2 by "Peter Rooney" <peter.rooney@p...> on Tue, 16 Apr 2002 15:53:54 +0100
|
|
Matt,
Try this:
Function MediumDate (str)
Dim aDay
Dim aMonth
Dim aYear
aDay = Day(str)
aMonth = Monthname(Month(str),True)
aYear = Year(str)
MediumDate = aDay & "-" & aMonth & "-" & aYear
End Function
Then
MediumDate(Date())
This will pass the date as 16 April 2002, it will still store it in SQL in
the Americam format but in the correct sequence.
HTH
Peter
-----Original Message-----
From: m.murray@s... [mailto:m.murray@s...]
Sent: 16 April 2002 15:10
To: ASP Web HowTo
Subject: [asp_web_howto] British / US Date display
Hi there
Both my webserver & webhost run SQL Server 7. One of my ASP pages displays
a date - but they display differently on the servers.
On my webserver it displays as 25/4/02 (British dd/mm/yy)
but on my webhost it displays the American way 4/25/02 (American mm/dd/yy)
Has anyone written a function to display the date the British way??
HELP!! It's driving me nuts!
Cheers in advance
Matt
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
Message #3 by bobby.sojitra@b... on Tue, 16 Apr 2002 15:53:44 +0100
|
|
Just before you define your date, include this line :
Session.LCID = 2057
This will display all dates in british format.
Alternatively, the VERY FIRST LINE of your asp page should be :
<%@Language=vbscript LCID = 2057%>
All the dates in this ASP page will be handled in British format.The second
way is a better way to do it.
For different formats, just search for "LCID codes" in a search engine to
see different world LCID codes. Hope that helps dude.
-----Original Message-----
From: m.murray@s... [mailto:m.murray@s...]
Sent: 16 April 2002 16:10
To: ASP Web HowTo
Subject: [asp_web_howto] British / US Date display
Hi there
Both my webserver & webhost run SQL Server 7. One of my ASP pages displays
a date - but they display differently on the servers.
On my webserver it displays as 25/4/02 (British dd/mm/yy)
but on my webhost it displays the American way 4/25/02 (American mm/dd/yy)
Has anyone written a function to display the date the British way??
HELP!! It's driving me nuts!
Cheers in advance
Matt
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
|
|
 |