Date Time Culture Format

B

Brad

Is there a way to determine the OS's date/time culture format (e.g.
mm/dd/yyy vs. dd/mm/yyy) setting at run time?

TIA

Brad
 
J

Jon Skeet [C# MVP]

Brad said:
Is there a way to determine the OS's date/time culture format (e.g.
mm/dd/yyy vs. dd/mm/yyy) setting at run time?

CultureInfo.CurrentCulture.DateTimeFormat will give you a
DateTimeFormatInfo which should have the info you need.

In some situations, CurrentUICulture would be more appropriate. See the
docs for more details.
 
J

Jon Skeet [C# MVP]

Mihai said:
Sorry to contradict, but in all situations dealing with formats
(number/date/time), CurrentCulture is the thing you need.
See "Two things that suck about CurrentUICulture"
http://blogs.msdn.com/michkap/archive/2007/01/10/1442340.aspx

Ah, I see. I was under the mistaken impression that in an ASP.NET
setting, the CurrentUICulture would be set to the CultureInfo of the
browsing user whereas CurrentCulture would be the system default
culture.

It is indeed a bit of a mess. Still, just one more bit of i18n
trickery...

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top