Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8398531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:04:37+00:00 2026-06-09T21:04:37+00:00

Having upgraded to Windows 8 RTM, some date time parsing code that I had

  • 0

Having upgraded to Windows 8 RTM, some date time parsing code that I had has stopped working. I’ve replicated this using a standard console app:

CultureInfo provider;

provider = new CultureInfo("en-US");

string testDate = "1/1/2012";

DateTime date = DateTime.MinValue;
if (DateTime.TryParseExact(testDate, 
      CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern,  // (dd/MM/yyyy)
      provider,
      DateTimeStyles.None,
      out date))
    Console.WriteLine("Date: {0}", date);
else
    Console.WriteLine("Can't parse date: {0} / {1}", testDate, date);

Console.ReadLine();

Outputs: Can't parse date: 1/1/2012 ...

I’ve also tried making the culture info “eb-GB” (as it makes no difference for the given format). However, if I change the input date to 01/01/2012, it works fine.

Has something changed in the .net 4.5 DateTime framework that affects this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:04:38+00:00Added an answer on June 9, 2026 at 9:04 pm

    You need to change the ShortDatePattern to use the one from the selected provider rather than the one in CurrentCulture.

    DateTime date = DateTime.MinValue;
    if (DateTime.TryParseExact(testDate, 
          provider.DateTimeFormat.ShortDatePattern, // Change this line
          provider,
          DateTimeStyles.None,
          out date))
        Console.WriteLine("Date: {0}", date);
    else
        Console.WriteLine("Can't parse date: {0} / {1}", testDate, date);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im currently having a hard time of solving this problem. I had just upgraded
I recently had to reinstall Windows and had several working copies checked out. I
Windows 8 build 8102, Kinect SDK V1.0 And so it begins that I had
I am having trouble converting some code from VB6 to VB.NET (I don't have
I recently upgraded one of my applications to Rails 2.2.2. Having done that, I've
Since I upgraded my Galaxy S2 to Android 4 I am having some weird
We just upgraded our app to Rails 3.2.2 and are now having a routing
Our team recently upgraded to TeamCity 4.5.4 but we're having trouble with TeamCity running
I'm having a strange issue with Azure! I just recently upgraded my azure deployed
Ever since I upgraded to Delphi 2009, I am having terrible experience with TFrame

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.