TimeZone module

class TimeZone.TimeZone

Bases: SpireObject

Represents a time zone.

property DaylightName: str

Gets the daylight name of the time zone. :returns: The daylight name of the time zone. :rtype: str

GetUtcOffset(time: DateTime) TimeSpan

Gets the UTC offset for a specified time. :param time: The time to get the UTC offset for. :type time: DateTime

Returns:

The UTC offset for the specified time.

Return type:

TimeSpan

IsDaylightSavingTime

Determines whether a specified time is daylight saving time. :param time: The time to check. :type time: DateTime

Returns:

True if the specified time is daylight saving time, False otherwise.

Return type:

bool

property StandardName: str

Gets the standard name of the time zone. :returns: The standard name of the time zone. :rtype: str

ToLocalTime(time: DateTime) DateTime

Converts a specified time to the local time of the time zone. :param time: The time to convert. :type time: DateTime

Returns:

The converted local time.

Return type:

DateTime

ToUniversalTime(time: DateTime) DateTime

Converts a specified time to Coordinated Universal Time (UTC). :param time: The time to convert. :type time: DateTime

Returns:

The converted time in UTC.

Return type:

DateTime

static get_CurrentTimeZone() TimeZone

Gets the current time zone. :returns: The current time zone. :rtype: TimeZone