TZConvert
Converts time zone identifiers from various sources.
プロパティ
public static ICollection<string> KnownIanaTimeZoneNames { get; }
value = TZConvert.KnownIanaTimeZoneNames
Gets a collection of all IANA time zone names known to this library.
public static ICollection<string> KnownRailsTimeZoneNames { get; }
value = TZConvert.KnownRailsTimeZoneNames
Gets a collection of all Rails time zone names known to this library.
public static ICollection<string> KnownWindowsTimeZoneIds { get; }
value = TZConvert.KnownWindowsTimeZoneIds
Gets a collection of all Windows time zone IDs known to this library.
メソッド
public static TimeZoneInfo GetTimeZoneInfo(string windowsOrIanaTimeZoneId)
result = TZConvert.GetTimeZoneInfo(windowsOrIanaTimeZoneId)
Retrieves a TimeZoneInfo object given a valid Windows or IANA time zone identifier, regardless of which platform the application is running on.
- windowsOrIanaTimeZoneId
- A valid Windows or IANA time zone identifier.
戻り値: A TimeZoneInfo object.
public static IList<string> IanaToRails(string ianaTimeZoneName)
result = TZConvert.IanaToRails(ianaTimeZoneName)
Converts an IANA time zone name to one or more equivalent Rails time zone names.
- ianaTimeZoneName
- The IANA time zone name to convert.
戻り値: One or more equivalent Rails time zone names.
public static string IanaToWindows(string ianaTimeZoneName)
result = TZConvert.IanaToWindows(ianaTimeZoneName)
Converts an IANA time zone name to the equivalent Windows time zone ID.
- ianaTimeZoneName
- The IANA time zone name to convert.
戻り値: A Windows time zone ID.
public static string RailsToIana(string railsTimeZoneName)
result = TZConvert.RailsToIana(railsTimeZoneName)
Converts a Rails time zone name to an equivalent IANA time zone name.
- railsTimeZoneName
- The Rails time zone name to convert.
戻り値: An IANA time zone name.
public static string RailsToWindows(string railsTimeZoneName)
result = TZConvert.RailsToWindows(railsTimeZoneName)
Converts a Rails time zone name to an equivalent Windows time zone ID.
- railsTimeZoneName
- The Rails time zone name to convert.
戻り値: A Windows time zone ID.
public static bool TryGetTimeZoneInfo(string windowsOrIanaTimeZoneId, TimeZoneInfo timeZoneInfo)
result = TZConvert.TryGetTimeZoneInfo(windowsOrIanaTimeZoneId, timeZoneInfo)
Attempts to retrieve a TimeZoneInfo object given a valid Windows or IANA time zone identifier, regardless of which platform the application is running on.
- windowsOrIanaTimeZoneId
- A valid Windows or IANA time zone identifier.
- timeZoneInfo
- A TimeZoneInfo object.
戻り値: true if successful, false otherwise.
public static bool TryIanaToRails(string ianaTimeZoneName, IList<string> railsTimeZoneNames)
result = TZConvert.TryIanaToRails(ianaTimeZoneName, railsTimeZoneNames)
Attempts to convert an IANA time zone name to one or more equivalent Rails time zone names.
- ianaTimeZoneName
- The IANA time zone name to convert.
- railsTimeZoneNames
- One or more equivalent Rails time zone names.
戻り値: true if successful, false otherwise.
public static bool TryIanaToWindows(string ianaTimeZoneName, string windowsTimeZoneId)
result = TZConvert.TryIanaToWindows(ianaTimeZoneName, windowsTimeZoneId)
Attempts to convert an IANA time zone name to the equivalent Windows time zone ID.
- ianaTimeZoneName
- The IANA time zone name to convert.
- windowsTimeZoneId
- A Windows time zone ID.
戻り値: true if successful, false otherwise.
public static bool TryRailsToIana(string railsTimeZoneName, string ianaTimeZoneName)
result = TZConvert.TryRailsToIana(railsTimeZoneName, ianaTimeZoneName)
Attempts to convert a Rails time zone name to an equivalent IANA time zone name.
- railsTimeZoneName
- The Rails time zone name to convert.
- ianaTimeZoneName
- An IANA time zone name.
戻り値: true if successful, false otherwise.
public static bool TryRailsToWindows(string railsTimeZoneName, string windowsTimeZoneId)
result = TZConvert.TryRailsToWindows(railsTimeZoneName, windowsTimeZoneId)
Attempts to convert a Rails time zone name to an equivalent Windows time zone ID.
- railsTimeZoneName
- The Rails time zone name to convert.
- windowsTimeZoneId
- A Windows time zone ID.
戻り値: true if successful, false otherwise.
public static bool TryWindowsToIana(string windowsTimeZoneId, string ianaTimeZoneName)
result = TZConvert.TryWindowsToIana(windowsTimeZoneId, ianaTimeZoneName)
Attempts to convert a Windows time zone ID to an equivalent IANA time zone name. Uses the "golden zone" - the one that is the most prevalent.
- windowsTimeZoneId
- The Windows time zone ID to convert.
- ianaTimeZoneName
- An IANA time zone name.
戻り値: true if successful, false otherwise.
public static bool TryWindowsToIana(string windowsTimeZoneId, string territoryCode, string ianaTimeZoneName)
result = TZConvert.TryWindowsToIana(windowsTimeZoneId, territoryCode, ianaTimeZoneName)
Attempts to convert a Windows time zone ID to an equivalent IANA time zone name.
- windowsTimeZoneId
- The Windows time zone ID to convert.
- territoryCode
- An optional two-letter ISO Country/Region code, used to get a a specific mapping. Defaults to "001" if not specified, which means to get the "golden zone" - the one that is most prevalent.
- ianaTimeZoneName
- An IANA time zone name.
戻り値: true if successful, false otherwise.
public static bool TryWindowsToRails(string windowsTimeZoneId, IList<string> railsTimeZoneNames)
result = TZConvert.TryWindowsToRails(windowsTimeZoneId, railsTimeZoneNames)
Attempts to convert a Windows time zone ID to one ore more equivalent Rails time zone names. Uses the "golden zone" - the one that is the most prevalent.
- windowsTimeZoneId
- The Windows time zone ID to convert.
- railsTimeZoneNames
- One or more equivalent Rails time zone names.
戻り値: true if successful, false otherwise.
public static bool TryWindowsToRails(string windowsTimeZoneId, string territoryCode, IList<string> railsTimeZoneNames)
result = TZConvert.TryWindowsToRails(windowsTimeZoneId, territoryCode, railsTimeZoneNames)
Attempts to convert a Windows time zone ID to one ore more equivalent Rails time zone names.
- windowsTimeZoneId
- The Windows time zone ID to convert.
- territoryCode
- An optional two-letter ISO Country/Region code, used to get a a specific mapping. Defaults to "001" if not specified, which means to get the "golden zone" - the one that is most prevalent.
- railsTimeZoneNames
- One or more equivalent Rails time zone names.
戻り値: true if successful, false otherwise.
public static string WindowsToIana(string windowsTimeZoneId, string territoryCode)
result = TZConvert.WindowsToIana(windowsTimeZoneId, territoryCode)
Converts a Windows time zone ID to an equivalent IANA time zone name.
- windowsTimeZoneId
- The Windows time zone ID to convert.
- territoryCode
- An optional two-letter ISO Country/Region code, used to get a a specific mapping. Defaults to "001" if not specified, which means to get the "golden zone" - the one that is most prevalent.
戻り値: An IANA time zone name.
public static IList<string> WindowsToRails(string windowsTimeZoneId, string territoryCode)
result = TZConvert.WindowsToRails(windowsTimeZoneId, territoryCode)
Converts a Windows time zone ID to one ore more equivalent Rails time zone names.
- windowsTimeZoneId
- The Windows time zone ID to convert.
- territoryCode
- An optional two-letter ISO Country/Region code, used to get a a specific mapping. Defaults to "001" if not specified, which means to get the "golden zone" - the one that is most prevalent.
戻り値: One or more equivalent Rails time zone names.