Vinoth Mohan Vinoth Mohan - 10 months ago 94
Python Question

How to conver datetime to timestamp epoch

i am new to python 2.7, wondering and facing issue how to convert datetime to timestamp epoch.

Also the date time is in current UTC.
example :
2016-05-11 18:33:44 to 1462958071


Convert string to python datetime object and then parse the seconds

a ="2016-05-11 18:33:44"
b= datetime.strptime(a,"%Y-%d-%m %H:%M:%S")
print b.strftime('%s') # returns time in epoch