from datetime import datetime as dt
# from string
datetime = dt.strptime('2022-01-01 23:59:59', '%Y-%m-%d %H:%M:%S')
# to string
print(datetime.strftime("%Y-%m-%d %H:%M:%S"))
# Python program to demonstrate time class
# import the date class
from datetime import time
# calling the constructor
my_time = time(16, 1, 5)
print("Entered time", my_time)
# Calling constructor with 0 argument
my_time = time()
print("
Time without argument", my_time)
# calling constructor with minute argument
my_time = time(minute=1)
print("
Time with one argument", my_time)
# calling constructor with hour argument
my_time = time(hour=8)
print("
Time with one argument", my_time)
# calling constructor with minute argument
my_time = time(second=5)
print("
Time with one argument", my_time)
# Python program to demonstrate date class
# import the date class
from datetime import date
# initializing constructor and passing arguments in the format year, month, date
my_date1 = date(1999, 3, 5)
print("Date passed as argument is", my_date1)