I need your help. I have parsed a web site, and I have harvested this:
2018-08-18T23:31:00
I searched, but couldn't find how to change datetime to timestamp
Example of my desired result :
1535414693077
I need your help. I have parsed a web site, and I have harvested this:
2018-08-18T23:31:00
I searched, but couldn't find how to change datetime to timestamp
Example of my desired result :
1535414693077
The previous answer is incorrect as there is no '%s' formatter in datetime, even though it works, sometimes. See this answer for how wrong it is to use '%s'.
from datetime import datetime
import pytz
pytz.utc.localize(datetime.strptime('2018-08-18T23:31:00', '%Y-%m-%dT%H:%M:%S')).timestamp()
Output (float): 1534635060.0