> From To Use seconds since the epoch struct_time in UTC gmtime() seconds > since the epoch struct_time in local time localtime() struct_time in UTC > seconds since the epoch calendar.timegm() struct_time in local time seconds > since the epoch mktime() >> >>
>>> d1 = datetime.strptime("Fri Apr 15 11:32:19 EDT 2016", '%a %b %d %H:%M:%S >>> %Z %Y') >>> d2 = datetime.strptime("Fri Apr 15 15:32:19 UTC 2016", '%a %b %d %H:%M:%S >>> %Z %Y') >>> st1 = d1.timetuple() >>> st2 = d2.timetuple() >>> print time.mktime(st1) 1460734339.0 >>> print calendar.timegm(st2) 1460734339 _______________________________________________ Python-es mailing list Python-es@python.org https://mail.python.org/mailman/listinfo/python-es FAQ: http://python-es-faq.wikidot.com/