filmov
tv
43. Time Object and Time Zone in Python with Code || Date Time Module-III Programming Tutorial

Показать описание
pytz is a Python module mostly used for resolving the issues related to time zone differences. This module determines the time of any region using the local timezone name taking UTC time as the reference. The datetime is a python built-in library.
Code:
from datetime import datetime
print("Current time:",current_time)
#time object containing current time
print("Now:",now)
print("Type of now is",type(now))
import pytz
print("NY time:",datetime_NY.strftime("%H:%M:%S"))
Code:
from datetime import datetime
print("Current time:",current_time)
#time object containing current time
print("Now:",now)
print("Type of now is",type(now))
import pytz
print("NY time:",datetime_NY.strftime("%H:%M:%S"))