DateTime.Parse with the "+" symbol

Posted by Blah_Blah on Stack Overflow See other posts from Stack Overflow or by Blah_Blah
Published on 2012-11-14T16:50:48Z Indexed on 2012/11/14 17:00 UTC
Read the original article Hit count: 244

Filed under:
|
|
|

So I have a piece of code which parses and validates user input:

DateTime myDateTime = DateTime.Parse(userInput,currentCulture);

Current culture is being set (to en-ca or en-fr) and the user Input is always in ISO 8601 format "yyyy-MM-dd".

If the user enters 1900-01-01 the date is created as expected. If the input is "1900-01+01" the date time created is 1899-12-31 6:00:00 PM No exception is thrown, the DateTime.Parse happily converts this to the wrong date.

To make this work I am using DateTime.ParseExact(userInput,"yyyy-MM-dd",currentCulture).

So my question is: whats up with the +01 or any + value? Am I missing something in ISO standard?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET