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

2 thoughts on “Daylight saving time and other time zone related information

  1. 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

  2. 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 Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>