Friday, October 24, 2025
HomeLanguagesPython time.timezone Constant

Python time.timezone Constant

Python time. timezone constant returns the local (non-DST) timezone offset in UTC format, where DST stands for Daylight Saving Time. It is negative in most of Western Europe, positive in the US, zero in the UK).  This constant returns the current timezone in which you reside.

Python3




import time
  
print(time.timezone)


Output:

-19800

time.tzname

A similar function to get the name of timezone is time.tzname. It gives output in the form of a tuple.  The tuple contains two strings. The first one is the non-DST timezone in the area, and the second one is the name of the DST timezone in the area.

Python3




import time
  
print(time.tzname)


Output:

('India Standard Time', 'India Summer Time')

time.altzone

It returns the offset of the local DST timezone, in seconds west of UTC

Python3




import time
  
print(time.altzone)


Output:

-23400

time.daylight

It returns Nonzero if a DST timezone is defined

Python3




import time
  
print(time.daylight)


Output:

0
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS