I am trying to parse a string in datetime in the following format:
[Day], [Date] [Month] [Year] [Time] [am / pm] [time zone] (example :)
Thursday, December 1, 2011 20:30 EST
I did this using DateTime.ParseExact with the format ("dddd, dd MMM yyyy hh: mmtt"). However, the timbre is causing me a problem. There is no timezone code written this way. I still don’t worry about the time zone, so I want to either remove it or read it - while the parsexact will work.
One way to remove it is to actually remove it from the string (using .Replace) - however, I don't know how many different time intervals the source will generate, and in any case, I think the long replacement string looks ugly and the error is -prone.
So, is there a way to either delete it or read it (and then I can ignore it)?
source
share