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