python timestanp

69

python timestanp -

#!/usr/bin/python3
import time
import datetime

start = "10/03/2021 08:00:00"
timestmp_start=int(time.mktime(datetime.datetime.strptime(start, "%d/%m/%Y %H:%M:%S").timetuple()))*1000
date_start=datetime.datetime.fromtimestamp(timestmp_start/1000).strftime("%d/%m/%Y %H:%M:%S")


#output:
#timestmp_start: 1615343400000
#date_start: "10/03/2021 08:00:00"

Comments

Submit
0 Comments