Python time.timezone Constant Last Updated : 05 Nov, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: -19800time.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: -23400time.daylight It returns Nonzero if a DST timezone is defined Python3 import time print(time.daylight) Output: 0 Comment More infoAdvertise with us Next Article Python time.timezone Constant E error_502 Follow Improve Article Tags : Python Python time-module Practice Tags : python Similar Reads Python | Timezone Conversion Most datetime items came back from the dateutil parser are naive, which means they don't have an explicit tzinfo. tzinfo determines the timezone and UTC offset. It is the standard ISO format for UTC datetime strings. UTC is the coordinated universal time, and is fundamentally the equivalent as GMT. 3 min read Python | time.time_ns() method Time module in Python provides various time-related functions. This module comes under Pythonâs standard utility modules. time.time_ns() method of Time module is used to get the time in nanoseconds since the epoch. To get the time in seconds since the epoch, we can use time.time() method. The epoch 2 min read 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 1 min read Python time.tzset() Function In Python, the tzset() function of the time module is based on the re-initialization settings using the environment variable TZ. tzset() method of time module in python resets the time transformation protocol. this timezone means non-DST seconds west of UTC time and altzone means DST seconds west of 3 min read Python time strptime() function The strptime() function in Python is used to format and return a string representation of date and time. It takes in the date, time, or both as an input, and parses it according to the directives given to it. It raises ValueError if the string cannot be formatted according to the provided directives 2 min read Like