Python convert datetime to unix timestamp

// convert a datetime object into unix timestamp

import calendar
import datetime
now = datetime.datetime.now()
timestamp = calendar.timegm(now)
print now, timestamp

0 Comments

Post A Comment