- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What does method time.tzset() do in Python?
The time.tzset() method resets the time conversion rules used by the library routines. It uses the environment variable TZ to determine how to do this. It also sets the variables tzname (from the TZ environment variable), timezone (non-DST seconds West of UTC), altzone (DST seconds west of UTC) and daylight (to 0 if this timezone does not have any daylight saving time rules, or to nonzero if there is a time, past, present or future when daylight saving time applies).
This function is only available on Unix. The standard format of the TZ environment variable is −
std offset [dst [offset [,start[/time], end[/time]]]]
Example
You can use it as follows −
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')
Output
This will give the output −
13:00:40 02/17/09 EST 05:00:40 02/18/09 AEDT
- Related Articles
- What does an object() method do in Python?
- What does jQuery.serialize() method do in jQuery?
- What does Integer.parseInt() method do in Java?
- What does html() method do in jQuery?
- What does jQuery.andSelf( ) method do in jQuery?
- What does jQuery.children() method do in jQuery?
- What does jQuery.offset() method do in jQuery?
- What does the method toArray() do?
- What does "print >>" do in python?
- What does [::-1] do in Python?
- What does the method clear() do in java?
- What does the method clone() do in java?
- What does the method firstElement() do in java?
- What does the method lastElement() do in java?
- What does the method removeAllElements() do in java?

Advertisements