Skip to content

Instantly share code, notes, and snippets.

@kindy
Created December 3, 2012 15:26
Show Gist options
  • Save kindy/4195703 to your computer and use it in GitHub Desktop.
Save kindy/4195703 to your computer and use it in GitHub Desktop.
convert datetime to unix_timestamp
# convert datetime to unix_timestamp
import datetime, time
now = datetime.datetime.now()
ts = time.mktime(time.strptime(now.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment