Thursday, June 11, 2026
HomeLanguagesPython time.tzname() Function

Python time.tzname() Function

Time tzname() in Python returns the tuple of two strings in which the first string is the name of the local non-DST timezone and the second string is the name of the local DST timezone. 

Syntax: time.tzname()

Return: It will return the tuple of strings

Example 1: Python program to get the DST and non DST

Python3




# import time module
import time
  
# get the DST
print(time.tzname)


Output:

('UTC', 'UTC')

Example 2: Use the index numbers to get the strings

Python3




# import time module
import time
  
# get the DST of first string
print(time.tzname[0])
  
# get the DST of second string
print(time.tzname[1])


Output:

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

Most Popular

Dominic
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6896 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS