Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
609 lines (550 sloc) 40.4 KB
<Type Name="TimeZone" FullName="System.TimeZone">
<TypeSignature Language="C#" Value="public abstract class TimeZone" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract serializable beforefieldinit TimeZone extends System.Object" />
<TypeSignature Language="DocId" Value="T:System.TimeZone" />
<TypeSignature Language="VB.NET" Value="Public MustInherit Class TimeZone" />
<TypeSignature Language="C++ CLI" Value="public ref class TimeZone abstract" />
<TypeSignature Language="F#" Value="type TimeZone = class" />
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netcore-2.0;netcore-2.1;netstandard-2.0;netcore-2.2;netcore-3.0;netstandard-2.1">
<AttributeName>System.Obsolete("System.TimeZone has been deprecated. Please investigate the use of System.TimeZoneInfo instead.")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0">
<AttributeName>System.Serializable</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents a time zone.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A time zone is a geographical region in which the same standard time is used.
> [!IMPORTANT]
> Whenever possible, use the <xref:System.TimeZoneInfo> class instead of the <xref:System.TimeZone> class.
You can use the <xref:System.TimeZone> class to retrieve information about the current time zone, and to convert times from local time to Coordinated Universal Time (UTC) or vice versa. However, you cannot use the <xref:System.TimeZone> class to represent time zones other than the local zone or to handle date and time conversions from one time zone to another. For this purpose, use the <xref:System.TimeZoneInfo> class. You can use this class to retrieve information on any time zone defined on the local system, to create custom time zones, and to convert times from one time zone to another.
The <xref:System.TimeZone> class supports only a single daylight saving time adjustment rule for the local time zone. As a result, the <xref:System.TimeZone> class can accurately report daylight saving time information or convert between UTC and local time only for the period in which the latest adjustment rule is in effect. In contrast, the <xref:System.TimeZoneInfo> class supports multiple adjustment rules, which makes it possible to work with historic time zone data.
## Examples
The following example references and displays selected `TimeZone` class elements.
[!code-cpp[System.TimeZone.Class#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp#1)]
[!code-csharp[System.TimeZone.Class#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone.Class/CS/tzclass.cs#1)]
[!code-vb[System.TimeZone.Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb#1)]
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>In addition to providing implementations for its <see langword="abstract" /> members (those marked <see langword="MustOverride" /> in Visual Basic), it is important that classes derived from <see cref="T:System.TimeZone" /> override the default behavior of the <see cref="M:System.TimeZone.ToLocalTime(System.DateTime)" /> method. This is because the default behavior of <see cref="M:System.TimeZone.ToLocalTime(System.DateTime)" /> in the .NET Framework version 2.0 does not depend on a call to <see cref="M:System.TimeZone.GetUtcOffset(System.DateTime)" />, as it did in the .NET Framework versions 1.0 and 1.1. For details, see the <see cref="M:System.TimeZone.ToLocalTime(System.DateTime)" /> method.</para>
</block>
<altmember cref="T:System.DateTime" />
<altmember cref="T:System.DateTimeOffset" />
<altmember cref="T:System.TimeZoneInfo" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected TimeZone ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.#ctor" />
<MemberSignature Language="VB.NET" Value="Protected Sub New ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; TimeZone();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.TimeZone" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CurrentTimeZone">
<MemberSignature Language="C#" Value="public static TimeZone CurrentTimeZone { get; }" />
<MemberSignature Language="ILAsm" Value=".property class System.TimeZone CurrentTimeZone" />
<MemberSignature Language="DocId" Value="P:System.TimeZone.CurrentTimeZone" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property CurrentTimeZone As TimeZone" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property TimeZone ^ CurrentTimeZone { TimeZone ^ get(); };" />
<MemberSignature Language="F#" Value="member this.CurrentTimeZone : TimeZone" Usage="System.TimeZone.CurrentTimeZone" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.TimeZone</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the time zone of the current computer.</summary>
<value>A <see cref="T:System.TimeZone" /> object that represents the current local time zone.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.TimeZone.CurrentTimeZone%2A> property corresponds to the <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType> property. Whenever possible, use the <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType> property.
## Examples
The following example references the `CurrentTimeZone` property and displays the names for standard time and daylight saving time for the local time zone.
[!code-cpp[System.TimeZone.Class#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp#1)]
[!code-csharp[System.TimeZone.Class#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone.Class/CS/tzclass.cs#1)]
[!code-vb[System.TimeZone.Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb#1)]
]]></format>
</remarks>
<block subset="none" type="usage">
<para>Local time zone data is cached after <see cref="P:System.TimeZone.CurrentTimeZone" /> is first used to retrieve time zone information. If the system's local time zone subsequently changes, the <see cref="P:System.TimeZone.CurrentTimeZone" /> property does not reflect this change. If you need to handle time zone changes while your application is running, use the <see cref="T:System.TimeZoneInfo" /> class and call its <see cref="M:System.TimeZoneInfo.ClearCachedData" /> method.</para>
</block>
<altmember cref="P:System.TimeZoneInfo.Local" />
</Docs>
</Member>
<Member MemberName="DaylightName">
<MemberSignature Language="C#" Value="public abstract string DaylightName { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string DaylightName" />
<MemberSignature Language="DocId" Value="P:System.TimeZone.DaylightName" />
<MemberSignature Language="VB.NET" Value="Public MustOverride ReadOnly Property DaylightName As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract property System::String ^ DaylightName { System::String ^ get(); };" />
<MemberSignature Language="F#" Value="member this.DaylightName : string" Usage="System.TimeZone.DaylightName" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the daylight saving time zone name.</summary>
<value>The daylight saving time zone name.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If daylight saving time is not used in the time zone, an empty string ("") is returned.
The <xref:System.TimeZone.DaylightName%2A> property corresponds to the <xref:System.TimeZoneInfo.DaylightName%2A?displayProperty=nameWithType> property. Whenever possible, use the <xref:System.TimeZoneInfo.DaylightName%2A?displayProperty=nameWithType> property.
## Examples
The following example references and displays the `DaylightName` property of the current time zone.
[!code-cpp[System.TimeZone.Class#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp#1)]
[!code-csharp[System.TimeZone.Class#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone.Class/CS/tzclass.cs#1)]
[!code-vb[System.TimeZone.Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.TimeZoneInfo.DaylightName" />
</Docs>
</Member>
<Member MemberName="GetDaylightChanges">
<MemberSignature Language="C#" Value="public abstract System.Globalization.DaylightTime GetDaylightChanges (int year);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Globalization.DaylightTime GetDaylightChanges(int32 year) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.GetDaylightChanges(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetDaylightChanges (year As Integer) As DaylightTime" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract System::Globalization::DaylightTime ^ GetDaylightChanges(int year);" />
<MemberSignature Language="F#" Value="abstract member GetDaylightChanges : int -&gt; System.Globalization.DaylightTime" Usage="timeZone.GetDaylightChanges year" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Globalization.DaylightTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="year" Type="System.Int32" />
</Parameters>
<Docs>
<param name="year">The year that the daylight saving time period applies to.</param>
<summary>Returns the daylight saving time period for a particular year.</summary>
<returns>A <see cref="T:System.Globalization.DaylightTime" /> object that contains the start and end date for daylight saving time in <paramref name="year" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Only one daylight saving time period per year is supported.
If daylight saving time is not used in the current time zone, the return value is a <xref:System.Globalization.DaylightTime> object, where the value of <xref:System.Globalization.DaylightTime.Start%2A> and <xref:System.Globalization.DaylightTime.End%2A> is <xref:System.DateTime.MinValue?displayProperty=nameWithType>, and the value of <xref:System.Globalization.DaylightTime.Delta%2A?displayProperty=nameWithType> is a <xref:System.TimeSpan> initialized to 0 ticks.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="year" /> is less than 1 or greater than 9999.</exception>
<block subset="none" type="usage">
<para>Because the <see cref="T:System.TimeZone" /> class supports only one daylight saving time adjustment rule, the <see cref="M:System.TimeZone.GetDaylightChanges(System.Int32)" /> method applies the current adjustment rule to any year, regardless of whether the adjustment rule actually applies to that year. Assuming that the operating system itself has accurate data for a particular year, a more accurate result is available by working with the array of <see cref="T:System.TimeZoneInfo.AdjustmentRule" /> objects returned by the <see cref="M:System.TimeZoneInfo.GetAdjustmentRules" /> method. The <see cref="P:System.Globalization.DaylightTime.Start" />, <see cref="P:System.Globalization.DaylightTime.End" />, and <see cref="P:System.Globalization.DaylightTime.Delta" /> properties correspond to the <see cref="P:System.TimeZoneInfo.AdjustmentRule.DateStart" />, <see cref="P:System.TimeZoneInfo.AdjustmentRule.DateEnd" />, and <see cref="P:System.TimeZoneInfo.AdjustmentRule.DaylightDelta" /> properties.</para>
</block>
<altmember cref="M:System.TimeZoneInfo.GetAdjustmentRules" />
</Docs>
</Member>
<Member MemberName="GetUtcOffset">
<MemberSignature Language="C#" Value="public abstract TimeSpan GetUtcOffset (DateTime time);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance valuetype System.TimeSpan GetUtcOffset(valuetype System.DateTime time) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.GetUtcOffset(System.DateTime)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetUtcOffset (time As DateTime) As TimeSpan" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract TimeSpan GetUtcOffset(DateTime time);" />
<MemberSignature Language="F#" Value="abstract member GetUtcOffset : DateTime -&gt; TimeSpan" Usage="timeZone.GetUtcOffset time" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.TimeSpan</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="time" Type="System.DateTime" />
</Parameters>
<Docs>
<param name="time">A date and time value.</param>
<summary>Returns the Coordinated Universal Time (UTC) offset for the specified local time.</summary>
<returns>The Coordinated Universal Time (UTC) offset from <paramref name="time" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method returns the offset, or difference, between the `time` parameter and Coordinated Universal Time (UTC). That is:
`time` = UTC + offset
The method interprets the time zone of `time` based on its <xref:System.DateTime.Kind%2A> property. If the value of the <xref:System.DateTime.Kind%2A> property is <xref:System.DateTimeKind.Local?displayProperty=nameWithType> or <xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType>, the method returns the offset of the local time zone. If the value of the <xref:System.DateTime.Kind%2A> property is <xref:System.DateTimeKind.Utc?displayProperty=nameWithType>, the method returns an offset equal to <xref:System.TimeSpan.Zero?displayProperty=nameWithType>.
If the local time zone observes daylight saving time, <xref:System.TimeZone.GetUtcOffset%2A> applies the current adjustment rule to `time` when determining the offset of the local time zone. That is, the offset returned by <xref:System.TimeZone.GetUtcOffset%2A> reflects whether `time` falls in the time zone's standard time or its daylight saving time.
> [!NOTE]
> The <xref:System.TimeZone.GetUtcOffset%2A> method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the UTC offset of a local time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule.
The <xref:System.TimeZone.GetUtcOffset%2A> method corresponds to the <xref:System.TimeZoneInfo.GetUtcOffset%2A?displayProperty=nameWithType> method. Whenever possible, use the <xref:System.TimeZoneInfo.GetUtcOffset%2A?displayProperty=nameWithType> method.
Because the date and time value represented by `time` and this value's offset from UTC are not tightly coupled, a local or unspecified date and time value can return a different offset value when run on different computers or when run on the same computer under different time zones. If this behavior is undesirable, use a <xref:System.DateTimeOffset> value instead. The <xref:System.DateTimeOffset> data type tightly couples a date and time value with its offset from UTC.
]]></format>
</remarks>
<altmember cref="M:System.TimeZoneInfo.GetUtcOffset(System.DateTime)" />
</Docs>
</Member>
<MemberGroup MemberName="IsDaylightSavingTime">
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Returns a value indicating whether a specified date and time is within a daylight saving time period.</summary>
</Docs>
</MemberGroup>
<Member MemberName="IsDaylightSavingTime">
<MemberSignature Language="C#" Value="public virtual bool IsDaylightSavingTime (DateTime time);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool IsDaylightSavingTime(valuetype System.DateTime time) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.IsDaylightSavingTime(System.DateTime)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function IsDaylightSavingTime (time As DateTime) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual bool IsDaylightSavingTime(DateTime time);" />
<MemberSignature Language="F#" Value="abstract member IsDaylightSavingTime : DateTime -&gt; bool&#xA;override this.IsDaylightSavingTime : DateTime -&gt; bool" Usage="timeZone.IsDaylightSavingTime time" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="time" Type="System.DateTime" />
</Parameters>
<Docs>
<param name="time">A date and time.</param>
<summary>Returns a value indicating whether the specified date and time is within a daylight saving time period.</summary>
<returns>
<see langword="true" /> if <paramref name="time" /> is in a daylight saving time period; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The year to which the daylight saving time period applies is derived from the `time` parameter.
Because the <xref:System.TimeZone> class supports a single daylight saving time adjustment rule, the <xref:System.TimeZone.IsDaylightSavingTime%28System.DateTime%29> method applies the current adjustment rule to any date, regardless of whether the adjustment rule was in effect on that date. Assuming that the operating system itself has accurate historic daylight saving time data, a more accurate result is available by using the <xref:System.TimeZoneInfo.IsDaylightSavingTime%2A?displayProperty=nameWithType> method. Whenever possible, use the <xref:System.TimeZoneInfo.IsDaylightSavingTime%2A?displayProperty=nameWithType> method.
]]></format>
</remarks>
<altmember cref="M:System.TimeZoneInfo.IsDaylightSavingTime(System.DateTime)" />
</Docs>
</Member>
<Member MemberName="IsDaylightSavingTime">
<MemberSignature Language="C#" Value="public static bool IsDaylightSavingTime (DateTime time, System.Globalization.DaylightTime daylightTimes);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool IsDaylightSavingTime(valuetype System.DateTime time, class System.Globalization.DaylightTime daylightTimes) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.IsDaylightSavingTime(System.DateTime,System.Globalization.DaylightTime)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function IsDaylightSavingTime (time As DateTime, daylightTimes As DaylightTime) As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static bool IsDaylightSavingTime(DateTime time, System::Globalization::DaylightTime ^ daylightTimes);" />
<MemberSignature Language="F#" Value="static member IsDaylightSavingTime : DateTime * System.Globalization.DaylightTime -&gt; bool" Usage="System.TimeZone.IsDaylightSavingTime (time, daylightTimes)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="time" Type="System.DateTime" />
<Parameter Name="daylightTimes" Type="System.Globalization.DaylightTime" />
</Parameters>
<Docs>
<param name="time">A date and time.</param>
<param name="daylightTimes">A daylight saving time period.</param>
<summary>Returns a value indicating whether the specified date and time is within the specified daylight saving time period.</summary>
<returns>
<see langword="true" /> if <paramref name="time" /> is in <paramref name="daylightTimes" />; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.TimeZoneInfo.IsDaylightSavingTime%2A?displayProperty=nameWithType> method provides the same functionality as this overload of the <xref:System.TimeZone.IsDaylightSavingTime%2A> method. Whenever possible, use the <xref:System.TimeZoneInfo.IsDaylightSavingTime%2A?displayProperty=nameWithType> method.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="daylightTimes" /> is <see langword="null" />.</exception>
<altmember cref="M:System.TimeZoneInfo.IsDaylightSavingTime(System.DateTime)" />
</Docs>
</Member>
<Member MemberName="StandardName">
<MemberSignature Language="C#" Value="public abstract string StandardName { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string StandardName" />
<MemberSignature Language="DocId" Value="P:System.TimeZone.StandardName" />
<MemberSignature Language="VB.NET" Value="Public MustOverride ReadOnly Property StandardName As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; abstract property System::String ^ StandardName { System::String ^ get(); };" />
<MemberSignature Language="F#" Value="member this.StandardName : string" Usage="System.TimeZone.StandardName" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the standard time zone name.</summary>
<value>The standard time zone name.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.TimeZone.StandardName%2A> property corresponds to the <xref:System.TimeZoneInfo.StandardName%2A?displayProperty=nameWithType> property. Whenever possible, use the <xref:System.TimeZoneInfo.StandardName%2A?displayProperty=nameWithType> property.
## Examples
The following example references and displays the `StandardName` property of the current time zone.
[!code-cpp[System.TimeZone.Class#1](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp#1)]
[!code-csharp[System.TimeZone.Class#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone.Class/CS/tzclass.cs#1)]
[!code-vb[System.TimeZone.Class#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.Class/VB/tzclass.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">An attempt was made to set this property to <see langword="null" />.</exception>
<altmember cref="P:System.TimeZoneInfo.StandardName" />
</Docs>
</Member>
<Member MemberName="ToLocalTime">
<MemberSignature Language="C#" Value="public virtual DateTime ToLocalTime (DateTime time);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance valuetype System.DateTime ToLocalTime(valuetype System.DateTime time) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.ToLocalTime(System.DateTime)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function ToLocalTime (time As DateTime) As DateTime" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual DateTime ToLocalTime(DateTime time);" />
<MemberSignature Language="F#" Value="abstract member ToLocalTime : DateTime -&gt; DateTime&#xA;override this.ToLocalTime : DateTime -&gt; DateTime" Usage="timeZone.ToLocalTime time" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="time" Type="System.DateTime" />
</Parameters>
<Docs>
<param name="time">A Coordinated Universal Time (UTC) time.</param>
<summary>Returns the local time that corresponds to a specified date and time value.</summary>
<returns>A <see cref="T:System.DateTime" /> object whose value is the local time that corresponds to <paramref name="time" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The following table shows the relationship between the `time` parameter and the <xref:System.DateTime> value returned by this method.
|`time` parameter|Behavior|Return value|
|----------------------|--------------|------------------|
|A Coordinated Universal Time (UTC) time (<xref:System.DateTimeKind.Utc?displayProperty=nameWithType>).|Converts the time from UTC to the local time.|A <xref:System.DateTime> object whose value is the local time that corresponds to `time`.|
|A local time (<xref:System.DateTimeKind.Local?displayProperty=nameWithType>).|No conversion necessary.|The same <xref:System.DateTime> value represented by the `time` parameter.|
|An unspecified time (<xref:System.DateTimeKind.Unspecified?displayProperty=nameWithType>).|Assumes that the time is UTC and converts it from UTC to the local time.|A <xref:System.DateTime> object whose value is the local time that corresponds to `time`.|
If the local time zone observes daylight saving time, <xref:System.TimeZone.ToLocalTime%2A> applies the current adjustment rule to `time` when performing the conversion.
> [!NOTE]
> The <xref:System.TimeZone.ToLocalTime%2A> method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the local time corresponding to a particular UTC time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule.
The <xref:System.TimeZone.ToLocalTime%2A> method corresponds to the <xref:System.TimeZoneInfo.ConvertTimeFromUtc%2A?displayProperty=nameWithType> method with its `destinationTimeZone` parameter set to <xref:System.TimeZoneInfo.Local%2A?displayProperty=nameWithType>. Whenever possible, use the <xref:System.TimeZoneInfo.ConvertTimeFromUtc%2A?displayProperty=nameWithType> method.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>Although it is not required, in most cases derived classes running under the .NET Framework version 2.0 should override the default implementation of this method. In the .NET Framework versions 1.0 and 1.1, the <see langword="ToLocalTime" /> method called the <see cref="M:System.TimeZone.GetUtcOffset(System.DateTime)" /> method and adjusted for daylight saving time when returning the local time. However, starting with the .NET Framework 2.0, the behavior of the default implementation depends on the <see cref="P:System.DateTime.Kind" /> property of the <paramref name="time" /> parameter. If its value is <see cref="F:System.DateTimeKind.Local" />, this method returns <paramref name="time" /> unchanged. If its value is either <see cref="F:System.DateTimeKind.Utc" /> or <see cref="F:System.DateTimeKind.Unspecified" />, this method assumes <paramref name="time" /> is UTC and converts it to the local system time without calling the <see cref="M:System.TimeZone.GetUtcOffset(System.DateTime)" /> method.
The following code provides a simple override of the default implementation of the <see langword="ToLocalTime" /> method. In this code, the <see langword="internalTimeZone" /> variable represents a private instance of the <see langword="TimeZone" /> class:
[!code-csharp[System.TimeZone.ToLocalTime#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.TimeZone.ToLocalTime/CS/TimeZone_ToLocalTime.cs#1)]
[!code-vb[System.TimeZone.ToLocalTime#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.TimeZone.ToLocalTime/VB/TimeZone_ToLocalTime.vb#1)]</para>
</block>
<altmember cref="M:System.TimeZoneInfo.ConvertTimeFromUtc(System.DateTime,System.TimeZoneInfo)" />
</Docs>
</Member>
<Member MemberName="ToUniversalTime">
<MemberSignature Language="C#" Value="public virtual DateTime ToUniversalTime (DateTime time);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance valuetype System.DateTime ToUniversalTime(valuetype System.DateTime time) cil managed" />
<MemberSignature Language="DocId" Value="M:System.TimeZone.ToUniversalTime(System.DateTime)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Function ToUniversalTime (time As DateTime) As DateTime" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual DateTime ToUniversalTime(DateTime time);" />
<MemberSignature Language="F#" Value="abstract member ToUniversalTime : DateTime -&gt; DateTime&#xA;override this.ToUniversalTime : DateTime -&gt; DateTime" Usage="timeZone.ToUniversalTime time" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>mscorlib</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Runtime</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.DateTime</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="time" Type="System.DateTime" />
</Parameters>
<Docs>
<param name="time">A date and time.</param>
<summary>Returns the Coordinated Universal Time (UTC) that corresponds to a specified time.</summary>
<returns>A <see cref="T:System.DateTime" /> object whose value is the Coordinated Universal Time (UTC) that corresponds to <paramref name="time" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the local time zone observes daylight saving time, <xref:System.TimeZone.ToUniversalTime%2A> applies the current adjustment rule to the `time` parameter when performing the conversion.
> [!NOTE]
> The <xref:System.TimeZone.ToUniversalTime%2A> method recognizes only the current daylight saving time adjustment rule for the local time zone. As a result, it is guaranteed to accurately return the Coordinated Universal Time (UTC) corresponding to a particular local time only during the period in which the latest adjustment rule is in effect. It may return inaccurate results if `time` is a historic date and time value that was subject to a previous adjustment rule.
If the `time` parameter is an ambiguous time, the method assumes that it is a standard time. (An ambiguous time is one that can map either to a standard time or to a daylight saving time in the local time zone.) If `time` is an invalid time, the method simply subtracts the local time from the local time zone's UTC offset to return UTC. (An invalid time is one that does not exist because of the application of daylight saving time adjustment rules.)
Because `time` is interpreted in relation to the current time zone on the current system, the date and time returned by this method can differ if an application is run on different computers or on the same computer with different time zones. For cases in which a date and time value must represent a single, unambiguous point in time, use a <xref:System.DateTimeOffset> value to represent the local time.
The <xref:System.TimeZone.ToUniversalTime%2A> method corresponds to the <xref:System.TimeZoneInfo.ConvertTimeToUtc%28System.DateTime%29?displayProperty=nameWithType> method overload with a <xref:System.DateTime> parameter whose <xref:System.DateTime.Kind%2A> property does not equal <xref:System.DateTimeKind.Utc?displayProperty=nameWithType>. Whenever possible, use the <xref:System.TimeZoneInfo.ConvertTimeToUtc%28System.DateTime%29?displayProperty=nameWithType> method overload.
]]></format>
</remarks>
<altmember cref="M:System.TimeZoneInfo.ConvertTimeToUtc(System.DateTime)" />
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.