Parse DateTime with time zone of form PST/CEST/UTC/etc
AFAIK the time zone abbreviations are not recognized. However if you replace the abbreviation with the time zone offset, it will be OK. E.g.:
DateTime dt1 = DateTime.ParseExact("24-okt-08 21:09:06 CEST".Replace("CEST", "+2"), "dd-MMM-yy HH:mm:ss z", culture);
DateTime dt2 = DateTime.ParseExact("24-okt-08 21:09:06 CEST".Replace("CEST", "+02"), "dd-MMM-yy HH:mm:ss zz", culture);
DateTime dt3 = DateTime.ParseExact("24-okt-08 21:09:06 CEST".Replace("CEST", "+02:00"), "dd-MMM-yy HH:mm:ss zzz", culture);
The quick answer is, you can't do it.
Here is why,
There is a definitive database of world timezones, you can get it from the IANA here.
The problem is, the 3 or 4 letter abbreviations have a many-to-one association with the IANA timezones. For instance "AMT"
means different things, depending on your culture, what part of the world you are in and the context of your application.
AMT "Armenia Time" Asia UTC + 4 hours
AMT "Amazon Time" South America UTC - 4 hours
If you really want to tackle this, I suggest using Noda Time to represent your Instance
s. You'll have to write some code to convert the abbreviations to a standard IANA timezone.
We can't do this for you, it depends on the context of your application.
Another good example is "CST"
.
CST "China Standard Time" Asia UTC + 8 hours
CST "Central Standard Time" Central America UTC - 6 hours
CST "Cuba Standard Time" Caribbean UTC - 5 hours
CST "Central Standard Time" North America UTC - 6 hours