Get timestamp in seconds from python's datetime
use time
, and int
to remove the milliseconds
from time import time
int(time())
# 1561043225
import time,datetime
time.mktime(datetime.datetime.today().timetuple())
If you don't have to get timestamp from structure datetime, you can decrease instruction like this
import time
print time.time()