Possible Duplicate:
Parse DateTime with timezone of form PST/CEST/UTC/etc
How to Convert PDT Time string to DateTime
I want to convert this value 05:41:33 Apr 23, 2012 PDT to datetime .
i am trying this but it is giving an error.
DateTime dt = Convert.ToDateTime("05:41:33 Apr 23, 2012 PDT");
Please help me guys how we can do it in C#.
Thanks,Rajbir
The PDT
is not recognizable as a timezone by any of the parsing options for a DateTime
in the BCL.
If you convert it to -0700
before parse it will parse ok.
string correctedTZ = "05:41:33 Apr 23, 2012 PDT".Replace("PDT", "-0700");
DateTime dt = Convert.ToDateTime(correctedTZ);
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