import time
time.time() #returns the unix timestamp
import time
import datetime
d = datetime.date(2015,1,5)
unixtime = time.mktime(d.timetuple())
# 1420412400.0 (float)
#get date from unix timestamp
from datetime import date
timestamp = date.fromtimestamp(1326244364)
# importing datetime module
import datetime
import time
# assigned regular string date
date_time = datetime.datetime(2021, 7, 26, 21, 20)
# print regular python date&time
print("date_time =>",date_time)
# displaying unix timestamp after conversion
print("unix_timestamp => ",
(time.mktime(date_time.timetuple())))
from datetime import datetime, timedelta
import time
dtime = datetime.now() + timedelta(seconds=3)
unixtime = time.mktime(dtime.timetuple())