How do I convert a datetime or date object into a POSIX timestamp in python? There are methods to create a datetime object out of a timestamp, but I don\'t seem to find any obv
For UTC calculations, calendar.timegm is the inverse of time.gmtime.
calendar.timegm
time.gmtime
import calendar, datetime d = datetime.datetime.utcnow() print calendar.timegm(d.timetuple())