Skip to content

Instantly share code, notes, and snippets.

@yeonsh
Created March 7, 2014 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yeonsh/9407615 to your computer and use it in GitHub Desktop.
Save yeonsh/9407615 to your computer and use it in GitHub Desktop.
Date string to timestamp
import time
import datetime
date_string = '2013-03-07'
date = datetime.datetime.strptime(date_string, '%Y-%m-%d')
time.mktime(date.timetuple())
==> 1362582000.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment