Created
June 21, 2014 08:32
-
-
Save richard-to/a927e402631a089753d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def datetime_to_timestamp(date, date_format): | |
""" | |
Converts date/time string to unix timestamp. Note that | |
the date/time string will interpreted using the local | |
timezone on your system. | |
The resulting unix timestamp will be in GMT time. | |
""" | |
dt = datetime.strptime(date, date_format) | |
return int(time.mktime(dt.timetuple())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment