Re: Finding the offset of a specific time zone
Eddie Lascu <[email protected]> Wed, 25 Mar 2009 12:30:36 -0400
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Organization | IBI Group |
| Message-ID | <[email protected]> |
Hi Per, You are right, the simple solution would be that, but I don't always know what is the offset, given that they keep changing when Daylight Saving Time comes into effect. Plus, I would like to come up with a general solution that can be easily ported on other systems. If they decide at some point in time to relocate the servers from Florida and move them to, say, India, I'd like my code to still work without me having to go and change anything. DST can come into effect one week in one location and three weeks later in another. I would have to always keep track of the offset and make sure it is always adjusted to reflect the reality. I'd rather rely on the operating system to do that for me. The time stamp from the field device comes as a string and would look something like this: "Mar 25 2009 09:25:56". I know this is California local time and I know now it is UTC+8. When DST comes into effect there too (I believe it didn't, I am in Toronto myself) the offset will be UTC+7. I don't want to have to make the decision on whether the DSTY is on or off. I want the OS to tell me that. What you are proposing makes sense except for the Offset part which I don't know how much is. At a maximum, my app should contain a configuration parameter telling me what time zone are the field devices located. From there I want to find out what is the offset of that zone compared to UTC. Regards, Eddie -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[email protected]] On Behalf Of Per Bolmstedt Sent: Wednesday, March 25, 2009 12:16 PM To: [email protected] Subject: Re: [ADVANCED-DOTNET] Finding the offset of a specific time zone On Wed, 25 Mar 2009 12:11:18 -0400, Eddie Lascu <[email protected]> wrote: > The question is how can I find out the offset of the time stamp that > comes from the field device. What exactly does a time stamp from the field device look like? If it doesn't specify its time zone at all, you can just to parse it as an UTC date and add the time zone offset you know it really has, compensating for UTC, can't you? =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives