Date Format

  • Thread starter Jason MacKenzie
  • Start date
J

Jason MacKenzie

I have a question regarding date formatting. I have a page that shows the
date incorrectly locally but correctly on the server yet the regional
settings appear to be the same.

I have a calendar control on the page that when clicked populates a text box
with 04/02/2005. Yet I have a html button that uses vbscript to populate
the same button with the value of NOW and I get 2/4/2005 10:41:38 AM.

I have my regional settings set to US and the short date format reads
2/4/2005.

I'm not sure what the problem may be.

Any help is appreciated,

Jason MacKenzie
 
K

Karl Seguin

Jason:
Your VbScript is running on the client, so obviously the client's setting
are being used to control the format. Your ASP.Net is run on the server,
so, by default, the server's settings are used.

This can be changed by setting the thread's culture via:
System.Threading.Thread.CurrentThread.CurrentCulture for example:
doing: System.Threading.Thread.CurrentThread.CurrentCulture = new
CultureInfo("fr-CA"); would format the date in Canadian French.

Check out the basics outlined here:
http://openmymind.net/localization/index.html#before

Oh, and you can get the user's culture via Request.UserLanguages[0]
http://msdn.microsoft.com/library/d...stemwebhttprequestclassuserlanguagestopic.asp

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top