Gets a TimeZoneInfo object that represents the local time zone.
Assembly: mscorlib (in mscorlib.dll)
The local time zone is the time zone on the computer where the code is executing.
The TimeZoneInfo object returned by the property reflects the setting of the Automatically adjust clock for daylight saving changes checkbox or the Automatically adjust clock for Daylight Saving Time checkbox in the Control Panel Date and Time application for Windows XP and Windows Vista, respectively. If the checkbox is unchecked, the cached copy of the local time zone contains no daylight saving time information. This means that:
The local time zone's GetAdjustmentRules method returns an array whose length is zero.
The local time zone's SupportsDaylightSavingTime property returns false.
All calls to IsDaylightSavingTime with individual local times return false.
This is not true, however, if a reference to the local time zone is retrieved using the FindSystemTimeZoneById method.
Notes to Callers:
In converting dates and times, Windows XP recognizes only the current adjustment rule, which it applies to all dates, including down-level dates (that is, dates that are earlier than the starting date of the current adjustment rule). On Windows XP, to prevent local date and time information provided by the TimeZoneInfo object returned by the property also applies the current adjustment rule to down-level dates. Applications running on Windows XP that require historically accurate local date and time calculations must work around this behavior by using the FindSystemTimeZoneById method to retrieve a TimeZoneInfo object that corresponds to the local time zone.object from diverging from the date and time information displayed in the system tray, the
The following example provides an illustration for a Windows XP system in the U.S. Pacific Time zone. Because the first three method calls all use the local time zone returned by the FindSystemTimeZoneById method to retrieve the local time zone, accurately performs this historical date and time conversion.property, they apply the current time zone adjustment rule (which went into effect in 2007) to a date in 2006. The current adjustment rule provides for the transition to daylight saving time to occur on the second Sunday of March; the previous rule, which was in effect in 2006, provided for the transition to daylight saving time to occur on the first Sunday of April. Only the fourth method call, which uses the
Available since 4.5
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8.1