Wie kann ich ein Datetime-Objekt in Python seit Epoch (Unix-Zeit) in Millisekunden konvertieren?
Habe ich ein Python - datetime
Objekt, das ich konvertieren zu unix-Zeit, oder Sekunden/Millisekunden seit 1970 Epoche.
Wie mache ich das?
Kommentar zu dem Problem
InformationsquelleAutor der Frage SuperString | 2011-08-09
Du musst angemeldet sein, um einen Kommentar abzugeben.
Erscheint es mir, dass der einfachste Weg, dies zu tun ist
InformationsquelleAutor der Antwort Sophie Alpert
Oder die Hilfe der Zeit-Modul (und ohne Datum-Formatierung):
Beantwortet mit Hilfe von: http://pleac.sourceforge.net/pleac_python/datesandtimes.html
Dokumentation:
Zeit.mktime
datetime.timetuple
InformationsquelleAutor der Antwort miku
In Python 3.3, fügen Sie neue Methode.
https://docs.python.org/3.3/library/datetime.html#datetime.datetime.timestamp
InformationsquelleAutor der Antwort eshizhan
Können Sie Delorean zu Reisen in Raum und Zeit!
http://delorean.readthedocs.org/en/latest/quickstart.html
InformationsquelleAutor der Antwort working4coins
Recommendedations aus der Python 2.7-Dokumentation für die
Zeit
- ModulInformationsquelleAutor der Antwort abc
Dies ist, wie ich es mache:
InformationsquelleAutor der Antwort estani
InformationsquelleAutor der Antwort corford
[1] http://docs.python.org/2/library/datetime.html#datetime.date.timetuple
[2] http://docs.python.org/2/library/time.html
InformationsquelleAutor der Antwort Jinesh
Hier ist eine andere form der Lösung mit der Normalisierung Ihrer Zeit Objekt:
InformationsquelleAutor der Antwort arhoskins
InformationsquelleAutor der Antwort MattoTodd
Etwas von pandas code:
InformationsquelleAutor der Antwort volhv
Diese andere Lösung für verdeckte datetime zu unixtimestampmillis.
InformationsquelleAutor der Antwort samsanthosh2008