Chris,
DateTime.Parse cannot recognize time zone abbreviations such as "PST"
(with the exception of "GMT" and "Z"). Time zone abbreviations can be
ambiguous -- for example, "CST" could represent a time zone in either
North America or Australia.
The following should work:
// This will convert the time from -08:00 to your local time zone.
DateTime.Parse("Thu, 18 Mar 2004 14:52:56-08:00");
// This will return a DateTime of 2004-03-18 14:52:56.
DateTime.Parse("Thu, 18 Mar 2004 14:52:56");
// This will ignore the 'PST' (treat it as a literal) and return a
// DateTime of 2004-03-18 14:52:56.
DateTime.ParseExact("Thu, 18 Mar 2004 14:52:56 PST",
"ddd, dd MMM yyyy HH:mm:ss 'PST'",
System.Globalization.DateTimeFormatInfo.InvariantInfo);
Covert.ToDateTime calls DateTime.Parse and will have the same issues.
I hope this helps.
Katy King
CLR BCL Test
--------------------
| From: "Chris Pels" <
[email protected]>
|
| I tried DateTime.Parse prior to posting the messagen and an exception is
| thrown that there is an unrecognized word starting at position 26.
|
| Chris
|
| | > try DateTime.Parse("Thu, 18 Mar 2004 14:52:56 PST");
| >
| > | > > How would you convert Thu, 18 Mar 2004 14:52:56 PST to a DateTime
| format?
| > > When I use Convert.ToDateTime("Thu, 18 Mar 2004 14:52:56 PST") I get
an
| > > exception at character 26, the "PDT".
| > >
| > > Thanks,
| > > Chris
| > >
| > >
| >
| >
|
|
|