Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Date Format

Reply
Thread Tools

Date Format

 
 
Jason MacKenzie
Guest
Posts: n/a
 
      02-04-2005
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



 
Reply With Quote
 
 
 
 
Karl Seguin
Guest
Posts: n/a
 
      02-04-2005
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.CurrentCultu re for example:
doing: System.Threading.Thread.CurrentThread.CurrentCultu re = 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/de...uagestopic.asp

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


"Jason MacKenzie" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Date Format - best way of converting a string into a date format Brian Candy ASP .Net 2 02-18-2004 02:13 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM
Given a date, how to find the beginning date and ending date of that week Matt C Programming 3 11-08-2003 09:07 PM
Given a date, how to find the beginning date and ending date of that week Matt C++ 2 11-08-2003 08:30 PM



Advertisments