Home > Enterprise >  how to parse "2013:11:21 15:11:04 02:00" to DateTime
how to parse "2013:11:21 15:11:04 02:00" to DateTime

Time:11-15

I would like to parse 2013:11:21 15:11:04 02:00 to DateTime

I tried

DateTime.ParseExact("2013:11:21 15:11:04 02:00", "yyyy:MM:dd hh:mm:sszzz", null)

but it throws System.FormatException

CodePudding user response:

Your format should include HH instead of hh since you are using a 24 hour clock:

DateTime.ParseExact("2013:11:21 15:11:04 02:00", "yyyy:MM:dd HH:mm:sszzz", null)

  • Related