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 7504603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:37:50+00:00 2026-05-29T21:37:50+00:00

given: DateTime parsedDate; if (DateTime.TryParseExact(0992012, ddMyyyy, null, DateTimeStyles.NoCurrentDateDefault, out parsedDate)) { Debug.WriteLine(YES); } else

  • 0

given:

        DateTime parsedDate;

        if (DateTime.TryParseExact("0992012", "ddMyyyy", null, DateTimeStyles.NoCurrentDateDefault, out parsedDate))
        {
            Debug.WriteLine("YES");
        }
        else
        {
            Debug.WriteLine("NO");
        }

Why is the output NO? Is this a bug?

  • 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-05-29T21:37:51+00:00Added an answer on May 29, 2026 at 9:37 pm

    That’s a bad format, basically – I don’t know whether it’s specified whether or not it should be accepted, but including a variable-width numeric field beside other numeric fields without any delimiters is a really bad idea.

    I suspect the parser sees this as 09 followed by 92 in a “take 1 or 2 digits for the month” and doesn’t realize that the 2 is meant to belong to the year part. That’s what the Noda Time parser would do, at least…

    If you can’t change your input format, you should massage the data in-place before trying to parse it – e.g.

    if (text.Length == 7)
    {
        text = text.Substring(0, 2) + "0" + text.Substring(2);
    }
    // Now parse as ddMMyyyy
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Python datetime.isocalendar() method returns a tuple (ISO_year, ISO_week_number, ISO_weekday) for the given datetime
Given a DateTime representing a person's birthday, how do I calculate their age in
Given a datetime.time value in Python, is there a standard way to add an
In MS SQL 2000 and 2005, given a datetime such as '2008-09-25 12:34:56' what
Given a specific DateTime value, how do I display relative time, like: 2 hours
Given a domain object: class BirthdayDomain { public DateTime Birthday { get; set; }
If given an entity with a DateTime as a string, what are my options
datetime.datetime.utcnow() Why does this datetime not have any timezone info given that it is
Given a variant, does VBScript have an equivalent of C#'s DateTime.TryParse method?
Given datetime.datetime.now(), how do I get this week's Monday - Sunday and then the

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.