Finding the offset of a specific time zone
Eddie Lascu <[email protected]> Wed, 25 Mar 2009 12:11:18 -0400
| Newsgroups | gmane.comp.windows.devel.dotnet.advanced |
|---|---|
| Organization | IBI Group |
| Message-ID | <[email protected]> |
Hello folks, Here is a problem I am facing right now. I work on an application that will be hosted on some servers located in Florida. The application collects data from some field devices located in California. The field devices contain a time stamp that represents the date and time when the device was last time updated. This, obviously, comes as Pacific local time. Every time a record related to the actual device is updated in the database, the application must update a date&time field. Since the application runs in Florida, this will be Eastern local time. I need to somehow be able to save these times in relation to UTC. The database is Oracle and it has two components, a date and time and an offset to the UTC. My question is whether I can somehow figure out programmatically what is the offset to UTC for various time zones. For the server where the application runs I can do something like this: DateTime dtNow = DateTime.Now; DateTime dtUtcNow = dtNow.ToUniversalTime(); double dOffset = (dtUtcNow - dtNow).TotalHours; The question is how can I find out the offset of the time stamp that comes from the field device. Is there any method in .Net that will give me that? .NET 3.5 has TimeZoneInfo, a class that seems to solve this very issue, but we are using a .NET 3.0 environment and TimeZoneInfo is not available. Does anyone has any idea how this can be achieved in .NET 3.0? Any suggestion will be highly appreciated. Regards, Eddie =================================== View archives and manage your subscription(s) at http://peach.ease.lsoft.com/archives