Created
March 17, 2014 11:12
-
-
Save benhosmer/9597511 to your computer and use it in GitHub Desktop.
Python script to convert a date to epoch time.
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
hiredate= '1981-06-03' | |
pattern = '%Y-%m-%d' | |
epoch = int(time.mktime(time.strptime(hiredate, pattern))) | |
print epoch | |
360388800 |
For hiredate in UTC I used:
epoch = int(calendar.gmtime(time.strptime(hiredate, pattern)))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
that was helpful, thanks.