ITimeZoneIDConverterTryConvertToUtcOffset Method

Tries to convert a String, which represents a time zone name (IANA time zone ID), into a UTC offset belonging to this time zone.

Definition

Namespace: FolkerKinzel.VCards
Assembly: FolkerKinzel.VCards (in FolkerKinzel.VCards.dll) Version: 8.1.0+9753915cd0f8006e7e5b4f62aa63aa3651006f06
C#
bool TryConvertToUtcOffset(
	string timeZoneID,
	out TimeSpan utcOffset
)

Parameters

timeZoneID  String
A String representing the name of a time zone.
utcOffset  TimeSpan
Contains the UTC offset after the method has been successfully returned. The argument is passed uninitialized.

Return Value

Boolean
true, if timeZoneID could be converted into a UTC offset, otherwise false.

Remarks

  Notes to Implementers

The TryConvertToUtcOffset(String, TimeSpan) method should at least be able to convert IANA time zone IDs into UTC offsets. (You could also convert POSIX time zone identifiers, for example.) It makes sense to use a 3rd-party NuGet package for the task, as .NET is currently not able to do this itself.

It is not necessary for the method to convert Strings that already represent a UTC offset, since the library FolkerKinzel.VCards already does this itself.

See Also