Last active
December 11, 2019 12:16
-
-
Save ruddra/0c6eaacd8ab31a6ec39d88893c049f5d to your computer and use it in GitHub Desktop.
String to Epoch using Python
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
import datetime | |
def convert_to_epoch(date_string, format="%Y-%m-%dT%H:%M:%SZ"): | |
dt = datetime.datetime.strptime(date_string, format) | |
return int(str(dt.timestamp())[:-2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment