Convert python datetime to epoch with strftime - Stack Overflow
stackoverflow.com › questions › 11743019If you want to convert a python datetime to seconds since epoch you could do it explicitly: >>> (datetime.datetime (2012,04,01,0,0) - datetime.datetime (1970,1,1)).total_seconds () 1333238400.0. In Python 3.3+ you can use timestamp () instead: >>> datetime.datetime (2012,4,1,0,0).timestamp () 1333234800.0.