I want to parse the following date format to a DateTime object in C#.
"19 Aug 2010 17:48:35 GMT+00:00"
How can I accomplish this?
I'd recommend using DateTime.ParseExact
.
DateTime.ParseExact(dateString, "dd MMM yyyy H:mm:ss \\G\\M\\Tzzz", System.Globalization.CultureInfo.InvariantCulture);
As suggested in the comments below, System.Globalization.CultureInfo.CurrentCulture
is a good thing to be aware of and use if you are doing a desktop application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With