Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2006

Tip: Looking for answers? Try searching our database.

DateTime Parse and Regional Settings

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Harold Crump - 16 Feb 2006 16:19 GMT
Greetings,

This is not strictly a ASP.NET question, but I am hoping someone can
help.

I have an ASP.NET web app that used the DateTime.Parse and Compare
methods a lot.

As expected, the Regional Settings/Culture on the server (Windows
Server 2003), affects the behaviour of those DateTime functions (date
formats in terms of US, UK, CAN, etc.).

Example - whether 2/10/2006 is interpreted as 2nd Oct or 10th Feb, etc.

My question is - exactly which setting in the Control Panel controls
that?
I have tried changing the date formats under Control Panel -> Regional
and Language Options, but that doesn't make a difference.

So where is this setting?

Thanks for any help.

-Harold
P.S. I know that I can control the behaviour of the function by
specifying a culture argument in the code, but I am looking for the
Control Panel setting that allows me to flip back and forth without
changing code.
Elton W - 16 Feb 2006 19:11 GMT
If you know is US Date format, you can use

DateTime.Parse("2/10/2006", new CultureInfo("en-US"));

HTH

Elton Wang

> Greetings,
>
[quoted text clipped - 24 lines]
> Control Panel setting that allows me to flip back and forth without
> changing code.
Harold Crump - 16 Feb 2006 20:25 GMT
> If you know is US Date format, you can use
>
> DateTime.Parse("2/10/2006", new CultureInfo("en-US"));

Yes, I know that - pl. read my P.S. ;)

My question is where in the Windows Control Panel those settings can be
changed.

Thanks !

> HTH
>
[quoted text clipped - 28 lines]
> > Control Panel setting that allows me to flip back and forth without
> > changing code.
Elton W - 16 Feb 2006 23:23 GMT
try change culture setting in Web.config:

<globalization
           requestEncoding="utf-8"
           responseEncoding="utf-8"
           culture="en-US"
  />

> > If you know is US Date format, you can use
> >
[quoted text clipped - 39 lines]
> > > Control Panel setting that allows me to flip back and forth without
> > > changing code.
Harold Crump - 17 Feb 2006 17:43 GMT
> try change culture setting in Web.config:
>
[quoted text clipped - 3 lines]
>             culture="en-US"
>    />

So there is no way to change the culture for the .NET framework using
the Windows Control Panel settings?

On what basis does the framework decide which culture to use, if
nothing is specified in the machine.config or the web.config (as in my
case).

It must be reading that from somewhere in the Windows operating system.

Any ideas?

Thanks !

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.