I have the data in string format "22:48:32 Jul 29, 2011 PDT" Now I want to convert it into datetime. How can I do it.
Asked
Active
Viewed 2,720 times
0
-
What have you tried? What didn't work? Please post your code and explain what problems you are having with it. – Oded Aug 04 '11 at 13:00
-
possible duplicate of [Parse DateTime with timezone of form PST/CEST/UTC/etc](http://stackoverflow.com/questions/241789/parse-datetime-with-timezone-of-form-pst-cest-utc-etc) – Bala R Aug 04 '11 at 13:14
1 Answers
0
You are probably after this method: DateTime.Parse(string)
PDT is -7 from GMT, so you can refer to the GMT and subtract 7 hours.
DateTime datetime = DateTime.Parse("Jul 29 2011 22:48:32 GMT"); // notice GMT
datetime = datetime.AddHours(-7); // minus 7 hours

Bazzz
- 26,427
- 12
- 52
- 69