Skip to content

Instantly share code, notes, and snippets.

@cdecl
Created September 26, 2022 13:11
Show Gist options
  • Save cdecl/64ba876925fb25020ff9ebc1e72ed19f to your computer and use it in GitHub Desktop.
Save cdecl/64ba876925fb25020ff9ebc1e72ed19f to your computer and use it in GitHub Desktop.
import time
from datetime import datetime
tm = time.localtime(1648771200000 / 1000)
s = time.strftime('%Y-%m-%d %H:%M:%S', tm)
print(s)
r = time.strptime("2022-05-01 09:00:00", '%Y-%m-%d %H:%M:%S')
print(r)
mi = time.mktime(r) * 1000
print(mi)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment