Show / Hide Table of Contents

Class TimeZoneInfoExtensions

Extend the sealed TimeZoneInfo class to support abbreviated time zone names.

Inheritance
System.Object
TimeZoneInfoExtensions
Namespace: WizardWrx
Assembly: WizardWrx.Core.dll
Syntax
public static class TimeZoneInfoExtensions : object

Methods

| Improve this Doc View Source

AbbreviateDaylightName(TimeZoneInfo)

Get the abbreviated time zone Daylight Name.

Declaration
public static string AbbreviateDaylightName(this TimeZoneInfo ptzi)
Parameters
Type Name Description
TimeZoneInfo ptzi

Specify the TimeZoneInfo object to process. This implicit paramteer is supplied by the runtime when the extension method is called.

Returns
Type Description
System.String

The abbreviated name is constructed from the name specified on the DaylightName property on the TimeZoneInfo object by extracting from it the first letter of each word.

| Improve this Doc View Source

AbbreviateDisplayName(TimeZoneInfo)

Get the abbreviated time zone Display Name.

Declaration
public static string AbbreviateDisplayName(this TimeZoneInfo ptzi)
Parameters
Type Name Description
TimeZoneInfo ptzi

Specify the TimeZoneInfo object to process. This implicit paramteer is supplied by the runtime when the extension method is called.

Returns
Type Description
System.String

The abbreviated name is constructed from the name specified on the DisplayName property on the TimeZoneInfo object by extracting from it the first letter of each word.

The Display Name sees much less use because it includes the UTC offset, which confuses users who are unfamiliar with the details of UTC in particular and time zones in general.

| Improve this Doc View Source

AbbreviatedStandardName(TimeZoneInfo)

Get the abbreviated time zone Standard Name.

Declaration
public static string AbbreviatedStandardName(this TimeZoneInfo ptzi)
Parameters
Type Name Description
TimeZoneInfo ptzi

Specify the TimeZoneInfo object to process. This implicit paramteer is supplied by the runtime when the extension method is called.

Returns
Type Description
System.String

The abbreviated name is constructed from the name specified on the StandardName property on the TimeZoneInfo object by extracting from it the first letter of each word.

| Improve this Doc View Source

GetCurrentTimeZoneName(TimeZoneInfo, DateTime, Boolean)

Given a DateTime object to establish whether to display the Stanadrd Name or the Daylight Name, return the appropriate string for the part of the year that it represents.

Declaration
public static string GetCurrentTimeZoneName(this TimeZoneInfo ptzi, DateTime pdtmDateTime, bool pfAbbreviate)
Parameters
Type Name Description
TimeZoneInfo ptzi

Specify the TimeZoneInfo object to process. This implicit paramteer is supplied by the runtime when the extension method is called.

DateTime pdtmDateTime

The IsDaylightSavingTime method on the ptzi instance establishes the correct string to return for the time that it represents, assuming that its DateTimeKind property is Local or that it is implicitly interpreted as such.

System.Boolean pfAbbreviate

When True, this flag causes the abbreviated time zone name to be displayed. Otherwise, the appropriate string from the extended TimeZoneInfo instance is returned.

Returns
Type Description
System.String

The return value is the standard or daylight time zone name string or abbreviation that represents the time specified by argument pdtmDateTime as directed by argument pfAbbreviate.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX