473,322 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

DateTime Parse and Regional Settings

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
4 3024
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kim Würtz | last post by:
Hi folks I have an C# app. connecting to a MS-ACCESS database with several tables. In a specific situations I have problems with a DateTime type in a table. The problem is when I want to...
1
by: adam | last post by:
Hi, I am having difficulty with the date time parse method: try{ System.IFormatProvider format = new CultureInfo("en- GB", true); DateTime dateActive = DateTime.Parse (txtDate.Text,format);...
5
by: Abdolhosein Vakilzadeh Ebrahimi | last post by:
Is there any way to construct a System.DateTime which doesn't check year, month and day to be in correct range== no validation? Thanks A.V.Ebrahimi
7
by: Robert Misiak | last post by:
Hello- I live in the US, however I'm attempting to make a product of mine more international-friendly. There are a number of instances where a calendar function of my program displays various...
1
by: vooose | last post by:
Consider an application which has *many* references to DateTime.Parse(string); Is there a way, say when the application first starts up to force this method to use a specific IFormatProvider,...
4
by: Shawn | last post by:
Hi. I can't figure out how to solve this problem, so if anyone here can help me I will be forever grateful. I have a web application, which is placed on two different servers. One of the servers...
5
by: iulian.ilea | last post by:
Is correct to have a varchar field and insert dates of type dd/mm/yyyy into it? I choose this method because I have an application that runs on more than one server. So, if I used a datetime field...
4
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I am having a problem formatting a string when the time is in format hh.mm.ss - used in Europe Parse seems ok when the date uses "/" or "." as seperator but I get an exception when time...
5
by: Sreenivas | last post by:
Hi every one, I need to compare to datetime values , done in stored procedure.The input datetime parameter is in dd/mm/yyyy hh:mm:ss AM/PM format ,the datetime values to be compared are also...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.