Answered by:
Microsoft .NET Framework 2.0

Question
-
Datetime.tryparse is not giving the correct output. If we give the date as 20-feb-29 result is 20-feb-2029 but if we give it as 20-feb-30 the result is 20-feb-1930, can you help on this?
- Edited by Akash Prasad Monday, May 5, 2014 1:07 PM
Monday, May 5, 2014 1:02 PM
Answers
-
Sounds like the 2029 rule got applied.
http://support.microsoft.com/kb/302768
Might ask them over here.
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows]
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.Tuesday, May 6, 2014 12:42 AM
All replies
-
I've also faced same problem. No idea!Monday, May 5, 2014 1:05 PM
-
Hello,
I'd argue that the output is correct, and the assumptions are incorrect.
Ho do you know that 20-feb-30 does not refer to 20th February, 1930?
If you insist that it should be 2030, use a four digit year.
No need to repeat the Y2K programming short sightedness.
Karl
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
My Blog: Unlock PowerShell
My Book: Windows PowerShell 2.0 Bible
My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})Monday, May 5, 2014 8:58 PM -
Sounds like the 2029 rule got applied.
http://support.microsoft.com/kb/302768
Might ask them over here.
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows]
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.Tuesday, May 6, 2014 12:42 AM