I take date from QDateTimeEdit and convert it to seconds like this:
QDateTimeEdit
import time from datetime import datetime date = self.__ui.dateTimeEdit.date().
Use QDateTime.toMSecsSinceEpoch:
>>> import PyQt4.QtCore >>> d = PyQt4.QtCore.QDateTime(2014, 2, 20, 17, 10, 30) >>> d.toMSecsSinceEpoch() / 1000 1392883830L
UPDATE
Alternative using QDateTime.toTime_t:
>>> d = PyQt4.QtCore.QDateTime(2014, 2, 20, 17, 10, 30) >>> d.toTime_t() 1392883830L