c# - Unexpected behaviour of Convert.ToDateTime() -



c# - Unexpected behaviour of Convert.ToDateTime() -

consider next code snippet:

datetime dt = convert.todatetime("06/16/2014 -0:10"); console.write (dt.tostring()); console.readkey();

the output 6/15/2014 8:10:00 pm.

this came during testing of web application time of day allowed entered manually (date, hh , mm in separate asp.net textbox controls) , characters not limited digits (asp .net validator command accepts "-0" integer in 0..23 range).

can explain logic how string converted date/time? either expect exception thrown or "6/16/2014 12:10:00 am" considering "-0" same "0" ("06/16/2014 0:10" converts "6/16/2014 12:10:00 am" 1 expect).

according msdn think have set timezone -10 minutes.

datestring = "2009-05-01t07:54:59.9843750-04:00"; convert.todatetime(datestring); // '2009-05-01t07:54:59.9843750-04:00' converts 5/1/2009 4:54:59 local time.

c# .net datetime

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -