Detect local date time format

I have an app that relies on custom date/time formatting, and thus I need to detect what date/time format the local machine is running, i.e. is it 12 hour or 24 hour time format and is the date dd/mm or mm/dd. I'm amazed I can't find any info about this anywhere.
ShaunDumasAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nepaluzCommented:
why do you need to detect the local machine date/time format for? Just retrieve the datetime and put it in your mask (equal to your format mask), then compare it with your format. No need to know what the local machine formats the date and time as.
0
chingmdCommented:
This is the only thing that I was able to find:

http://forums.asp.net/t/1109014.aspx/1

Look for:


Sure, there's a simpler way to go!

Just place a <pages culture="Auto" /> element in your Web.config (under the system.web element) and each user will get the dates formatted to their own preferences.

If you want all users to get a dd/mm/yyyy format, just write <pages culture="fr-FR" /> for instance...


It sounds like you are attempting to do some localization printing.
0
Imran Javed ZiaConsultant Software Engineer - .NET ArchitectCommented:
Hi,

Dim sortDate As String = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern

It will give give you current windows date format

Thanks
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ShaunDumasAuthor Commented:
Excellent!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.