epoch time conversion code example Example: datetime to epoch >>> datetime.datetime(2012,4,1,0,0).timestamp() 1333234800.0