all groups > asp.net building controls > february 2006 >
You're in the

asp.net building controls

group:

Converting the time from one timezone to another


Re: Converting the time from one timezone to another William Stacey [MVP]
2/18/2006 12:00:00 AM
asp.net building controls:
See my UTC project for sql. It has the c# class you need.
http://channel9.msdn.com/ShowPost.aspx?PostID=142586

--
William Stacey [MVP]
|

Re: Converting the time from one timezone to another aweska don
2/18/2006 12:18:49 AM
Converting the time from one timezone to another Nathan Sokalski
2/18/2006 2:19:49 AM
I asked a question about a week ago about how to get my local time, since my
application is running on a server halfway around the world. I have
determined that my code would look something like this:

Dim servertime As Date = Date.Now

Dim utctime As Date = servertime.ToUniversalTime()

Dim localtime As Date


I know that the last step would be to adjust the utctime value by the
appropriate amount using code such as utctime.AddHours(-5), but I am looking
for a way to get this value by supplying the timezone rather than an offset
(in other words, I am looking for a function that returns either a
System.TimeSpan or Integer when I enter the timezone) so that I can do
something such as

utctime.AddHours(GetTZOffset(TimeZones.EST))

Is there a function that does this, or any way to get the offset by
submitting the timezone? Thanks.
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

AddThis Social Bookmark Button