The Problem Solver

Tell me and I will forget
Show me and I will remember
Involve me and I will understand
- Confucius -

Google Ads

This Blog

Syndication

Search

Tags

News





  • View Maurice De Beijer's profile on LinkedIn

Community

Email Notifications

Explore

Archives

Daylight saving time and other time zone related information
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
Published Wed, Sep 27 2006 8:49 by Maurice
Filed under:

Comments

# re: Daylight saving time and other time zone related information@ Monday, September 17, 2007 1:07 PM

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

by Dave

# re: Daylight saving time and other time zone related information@ Tuesday, September 18, 2007 2:07 AM

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

by Maurice