Python time altzone (Constant)



The Python time.altzone is the timezone constant of the time module. This holds the offset (or the difference between UTC time and local time) of the local DST timezone, in seconds west of UTC. This is still valid if for the local DST timezones east of UTC, but they are negative (as in Western Europe, including the UK).

The timezone constant daylight must be a non-zero for this method to be used. That means a DST timezone must be defined for altzone to work.

Note: This timezone constant is available in UNIX Systems only.

Syntax

Following is the syntax for the Python time.altzone() method −

time.altzone

Parameters

Since its a constant, it does not accept any parameters.

Return Value

It does not return any value. It just holds the offset of the local DST timezone, in seconds west of UTC, if one is defined.

Example

The following example shows the usage of the Python time.altzone() method.

import time

print("time.altzone:", time.altzone)

When we run above program, it produces following result −

time.altzone: -19800
python_date_time.htm
Advertisements