tags:

views:

332

answers:

1

how would you convert this date into c# Datetime object?

Mon Mar 16 14:21:27 +0000 2009

i tried parseexact with format = "ddd MMM dd hh:mm:ss zzzz yyyy" but it didn't work.

what did i do wrong?

+6  A: 

For 24-hour hours, you want HH, not hh:

DateTime when = DateTime.ParseExact("Mon Mar 16 14:21:27 +0000 2009",
    "ddd MMM dd HH:mm:ss zzzz yyyy",
    CultureInfo.InvariantCulture);
Marc Gravell