Skip to content

Instantly share code, notes, and snippets.

@gargolito
Created May 1, 2019 18:31
Show Gist options
  • Select an option

  • Save gargolito/ce6c208fd032673bdd7aeb246eebd169 to your computer and use it in GitHub Desktop.

Select an option

Save gargolito/ce6c208fd032673bdd7aeb246eebd169 to your computer and use it in GitHub Desktop.
#python
# convert string time to epoch
In [1]: from datetime import datetime
In [2]: ts = '2017-01-16 19:35:49.105642'
In [3]: datetime.strptime(ts, "%Y-%m-%d %H:%M:%S.%f").strftime("%s")
Out[4]: '1484613349'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment