Daylight saving time and other time zone related information

Posted Wednesday, September 27, 2006 8:49 AM by Maurice
Sometimes you need to know just that little bit more about the time zone a user is in. You might need to know the time difference between their local time and UTC, whether they are in daylight saving time or when the daylight saving period starts and ends.
 
Well the TimeZone type is our friend. The TimeZone.CurrentTimeZone will give you all sorts of information like if daylight saving time is in effect, the IsDaylightSavingTime() function, or offset from UTC, the GetUtcOffset() function.
 
Additionally the GetDaylightChanges() functin will give you more detail about when the daylight saving period starts and ends and the time change involved.
 
Enjoy!
 
Maurice de Beijer
Filed under:

Comments

# re: Daylight saving time and other time zone related information

Monday, September 17, 2007 1:07 PM by Dave

Yeah, it will give you all this only according to current timezone information...  If you're in Arizona, It will give you nothing !!!

Is there a way to get that same info for another zone, even if you're in a zone where there's NO DST, like Arizona ??? PLEASE, thanks.

Dave

# re: Daylight saving time and other time zone related information

Tuesday, September 18, 2007 2:07 AM by Maurice

Dave,

As far as I know there is no way to do so. Most of the implementation is actually in System.CurrentSystemTimeZone which uses some Win32 API calls that depend on the current Windows configuration.

Maurice

Leave a Comment

(required) 
(required) 
(optional)
(required)