Class TimeZoneInfoExtensions
Extend the sealed TimeZoneInfo class to support abbreviated time zone names.
Inheritance
Namespace: WizardWrx
Assembly: WizardWrx.Core.dll
Syntax
public static class TimeZoneInfoExtensions : object
Methods
| Improve this Doc View SourceAbbreviateDaylightName(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. |
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. |
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. |
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 |
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
|