Re: Finding the offset of a specific time zone
Peter Ritchie <[email protected]> Wed, 25 Mar 2009 13:12:15 -0400
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Message-ID | <LISTSERV%[email protected]> |
Yes, you'll have to make an assumption about the timezone of the time stamp if it's not coming in as UTC (I deal with "field devices" and they send UTC times...).
You can do what you want with something like:
DateTime datetime = new DateTime(1968, 11, 5, 12, 0, 0);
DateTime utcDateTime = TimeZoneInfo.ConvertTimeToUtc(datetime, TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"));
// TODO: persist utcDateTime somwhere.
For future readers, convert back to local time to display in the application like this:
DateTime localDateTime = utcDateTime.ToLocalTime();
===================================
View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives