How to convert current date to epoch timestamp ?
Format current date:
29.08.2011 11:05:02
Short-hand to convert python date/datetime to Epoch (without microseconds)
int(current_date.strftime("%s")) # 2020-01-14 ---> 1578956400
int(current_datetime.strftime("%s")) # 2020-01-14 16:59:30.251176 -----> 1579017570
Assuming you are using a 24 hour time format:
import time;
t = time.mktime(time.strptime("29.08.2011 11:05:02", "%d.%m.%Y %H:%M:%S"));
import time
def expires():
'''return a UNIX style timestamp representing 5 minutes from now'''
return int(time.time()+300)