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

  • SEARCH
  • Home
  • 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 7428467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:48:15+00:00 2026-05-29T08:48:15+00:00

I am writing a date in xml file & then reading a date from

  • 0

I am writing a date in xml file & then reading a date from xml file to display.
I have used Datetimepicker which has customFormat= MM/dd/yyyy. & it sets <date>02/29/2001</date> in xmlfile.

while reading if value is "02/02/2001"it reads & shows it perfectly in datetimepicker

but if value is "02/22/2001". edited:

it throws an exception.
String was not recognized as a valid DateTime.

  • 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-29T08:48:16+00:00Added an answer on May 29, 2026 at 8:48 am

    Have you set the cultureinfo of your application to expect the date in a MM/dd/yyyy format? It seems like it is expecting dd/MM/yyyy, that’s why 02/02/2001 works, I suspect 28/02/2001 would work as well.

    Edit: Hang on, 2001 was not a leap year, 29/02/2001 will never be a valid date!

    Edit: added sample

    // C#
    // Put the using statements at the beginning of the code module
    using System.Threading;
    using System.Globalization;
    // Put the following code before InitializeComponent()
    // Sets the culture to English (US)
    Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
    // Sets the UI culture to English (US)
    Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
    

    from here:
    http://msdn.microsoft.com/en-us/library/b28bx3bh%28v=vs.80%29.aspx
    more info in the link to the class in the comments

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a date/time value to an XML file by reading the date from
What format do I use for Date/Time when writing to an XML file using
I'm writing a bat script and I have to save the date from a
I am writing lots of info from an XML file into a database. Everything
I writing some ADT on C: I have two file date.c and date.h inside
I've been having problems writing XML and reading it in. I have a handwritten
A school project has me writing a Date game in C++ (example at http://www.cut-the-knot.org/Curriculum/Games/Date.shtml
So I am writing an application using ajax getting from a xml based api.
I'm writing a flex application that polls an xml file on the server to
I'm currently building large xml files with xml.dom.minidom and then writing them out to

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.