Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

<% =date %> in UK format 1

Status
Not open for further replies.

hayley

Programmer
Mar 14, 2001
13
GB
Can anyone tell me how to re-format a US date to a UK date (i.e. dd/mm/yyyy) using VBScript?

Thanks for your help!
 
Thanks - that article was really useful. If I didn't want to change the server settings for date and just wanted to format it to a UK format on a one-off, would it be possible to do that? (The article only lists how to format currency etc.)

Thanks again!
 
You can set the Local ID on a specific webpage, and it should return the date in that specific Local settings. You do this through the session object. I haven't tested this much, so I don't know how reliable this is.

<% Session.LCID = 0809 'Hex value for the UK %>

That technically should work too, but again, I'd test it. %>

VBScript normally returns dates formatted to the settings on whatever server it is on. If you want to be really sure that it formats it a different way, you could build your own date using Day(date), Month(date), and Year(date) to build a string.

Say I wanted to format my date like so DD/MM/YYYY

I'd do this:
<% response.write Day(date) & &quot;/&quot; & Month(date) & &quot;/&quot; & Year(date) %>

That way, you always know for a fact how the date is displayed in your page.

Hope that helps you. Harold Blackorby
hblackorby@scoreinteractive.com
St. Louis, MO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top