By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,784 Members | 3,582 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,784 IT Pros & Developers. It's quick & easy.

DateTime Parse and Regional Settings

P: n/a
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.

Feb 16 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
If you know is US Date format, you can use

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

Elton Wang

"Harold Crump" wrote:
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.

Feb 16 '06 #2

P: n/a
Elton W wrote:
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

Elton Wang

"Harold Crump" wrote:
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.


Feb 16 '06 #3

P: n/a
try change culture setting in Web.config:

<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="en-US"
/>
"Harold Crump" wrote:
Elton W wrote:
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

Elton Wang

"Harold Crump" wrote:
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.


Feb 16 '06 #4

P: n/a
Elton W wrote:
try change culture setting in Web.config:

<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
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 !

Feb 17 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.