Compartir a través de


TimeZoneInfo.DaylightName Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the localized display name for the current time zone's daylight saving time.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public ReadOnly Property DaylightName As String
public string DaylightName { get; }

Property Value

Type: System.String
The display name for the time zone's localized daylight saving time.

Remarks

A DaylightName property whose value is not String.Empty or nulla null reference (Nothing in Visual Basic) does not necessarily indicate that the time zone supports daylight saving time. To determine whether the time zone supports daylight saving time, check the value of its SupportsDaylightSavingTime property.

Version Notes

XNA Framework

 When this property is used in the XNA Framework, it throws a NotSupportedException exception.

Examples

The following example defines a method named DisplayDateWithTimeZoneName that uses the IsDaylightSavingTime(DateTime) method to determine whether to display a time zone's standard time name or daylight saving time name.

Private Sub DisplayDateWithTimeZoneName(ByVal outputBlock As System.Windows.Controls.TextBlock, ByVal date1 As Date, ByVal timeZone As TimeZoneInfo)
   outputBlock.Text += String.Format("The time is {0:t} on {0:d} {1}", _
                     date1, _
                     IIf(timeZone.IsDaylightSavingTime(date1), _
                         timeZone.DaylightName, timeZone.StandardName)) + vbCrLf
End Sub
private void DisplayDateWithTimeZoneName(System.Windows.Controls.TextBlock outputBlock, 
                                         DateTime date1, TimeZoneInfo timeZone)
{
   outputBlock.Text += String.Format("The time is {0:t} on {0:d} {1}",
                     date1,
                     timeZone.IsDaylightSavingTime(date1) ?
                         timeZone.DaylightName : timeZone.StandardName) + "\n";
}

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.