# Pastebin qcgh47es print datetime.strptime('2014/8/06 PM 10:57', '%Y/%m/%d %p %H:%M').strftime('%s') print datetime.strptime('2014/8/06 AM 10:57', '%Y/%m/%d %p %H:%M').strftime('%s')