import time
a=time.time()
print("Seconds since epoch :",a,end='n----------n')
print("Current date and time:")
print(time.ctime(a),end='n----------n')
print("Local time :")
print(time.localtime(a),end='n----------n')
print("Local time in UTC format :")
print(time.gmtime(a),end='n-----------n')
c = time.localtime()
d = time.strftime("%m/%d/%Y, %H:%M:%S", c)
print("String representing date and time:")
print(d,end='n----------n')
print("time.strptime parses string and returns it in struct_time format :n")
e = "06 AUGUST, 2019"
f = time.strptime(e, "%d %B, %Y")
print(f)
import datetime
print("Datetime constructor:n")
print(datetime.datetime(2019,5,3,8,45,30,234),end='n----------n')
print("The current date and time using today :n")
print(datetime.datetime.today(),end='n----------n')
print("The current date and time using today :n")
print(datetime.datetime.now(),end='n----------n')
print("Setting date :n")
print(datetime.date(2019,11,7),end='n----------n')
print("Setting time :n")
print(datetime.time(6,30,23),end='n----------n')
print("Converting seconds to date and time:n")
print(datetime.date.fromtimestamp(23456789),end='n----------n')
b1=datetime.timedelta(days=30, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=4, weeks=8)
b2=datetime.timedelta(days=3, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=4, weeks=8)
b3=b2-b1
print(type(b3))
print("The resultant duration = ",b3,end='n----------n')
a=datetime.datetime.now()
print(a)
print("The year is :",a.year)
print("Hours :",a.hour)