Saturday, 15 February 2014

c# - Converting string to DateTime failing -


I have a string variable whose data will be formatted below.

18-03-2015 16:39:15

I was trying to change it with a valid date time with hour / minute / second Am far in line to fail

  DateTimeDT = DateTime Purse Act ("18-03-2015 16: 39:15", "DD-MM-yyyy h: m: s", CultureInfo .InvariantCulture);  

You get the uppercase h or h < / Code>, therefore "dd-MM-yyyy HH: m: s" with this time: 16:39:15.

See:

Then lowercase is uppercase for 1 to 12 and 24 hours. If you use H or HH , then it depends on whether 4:39:15 is possible or 04 : 39: 15 . A single H supports both formats, so without leading zero or without, while HH only 04:39:15 .


No comments:

Post a Comment