I have string like this 2019-06-13 23:37:02.284175.
I would like to convert this string to unix time epoch.
How can I convert this string to unix timestamp using python??
2 Answers
In Python 3.7+ you can do this using datetime.datetime.fromisoformat:
import datetime
print(datetime.datetime.fromisoformat("2019-06-13 23:37:02.284175").timestamp())
Output:
1560469022.284175