Skip to content

Instantly share code, notes, and snippets.

@itkr
Created April 16, 2015 07:19
Show Gist options
  • Save itkr/d1dd925fdf071e99e1a3 to your computer and use it in GitHub Desktop.
Save itkr/d1dd925fdf071e99e1a3 to your computer and use it in GitHub Desktop.
timetuple
from datetime import datetime
import time
a = datetime.now()
# datetime.datetime(2015, 4, 16, 16, 15, 47, 92560)
b = int(time.mktime(a.timetuple()))
# 1429168547
datetime.fromtimestamp(b)
# datetime.datetime(2015, 4, 16, 16, 15, 47)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment