Easy Tutorial
❮ Python Os Ttyname Ref Math Remainder ❯

Python3 time tzset() Method


Description

The Python time tzset() method reinitializes the time-related settings based on the environment variable TZ.

Standard TZ environment variable format:

std offset [dst [offset [,start[/time], end[/time]]]]

Parameters

Syntax

time.tzset()

Parameters

Return Value

This function does not return any value.

Example

The following example demonstrates the use of the tzset() function:

#!/usr/bin/python3
import time
import os

os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'
time.tzset()
print(time.strftime('%X %x %Z'))

os.environ['TZ'] = 'AEST-10AEDT-11,M10.5.0,M3.5.0'
time.tzset()
print(time.strftime('%X %x %Z'))

The output of the above example is:

23:25:45 04/06/16 EDT
13:25:45 04/07/16 AEST
❮ Python Os Ttyname Ref Math Remainder ❯