Copyright © tutorialspoint.com

Python time tzset() Function

previous next


Description:

This function Resets the time conversion rules used by the library routines. The environment variable TZ specifies how this is done.

The standard format of the TZ environment variable is (whitespace added for clarity):

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

Syntax:

time.tzset()

Parameters:

Here is the detail of parameters:

Example:

#!/usr/bin/python
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')

This produces following result:

13:00:40 02/17/09 EST
05:00:40 02/18/09 AEDT

previous next

Copyright © tutorialspoint.com