I take date from QDateTimeEdit
and convert it to seconds like this:
import time
from datetime import datetime
date = self.__ui.dateTimeEdit.date().
The QDate
you get from
self.__ui.dateTimeEdit.date()
has another method toPyDate that will save you the round trip through a string.
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