Date Format

  • Thread starter Thread starter Jason MacKenzie
  • Start date 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
 
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
 
Back
Top