I'm trying to format Python datetime objects into strings using QLocale, but it seems that under SIP API v2, the time information is lost? Are datetime objects being interpreted as QDate rather than QDateTime? Here's an example:<br>
<br>#################<br># API v1<br>#################<br>from PyQt4.QtCore import *<br>locale = QLocale()<br>locale.toString(QDateTime.currentDateTime(), locale.dateTimeFormat())<br># returns PyQt4.QtCore.QString(u'Tuesday, 20 April 2010 15:06:19 ')<br>
<br>#################<br>
# API v2<br>
#################<br>import sip<br>sip.setapi("QString", 2)<br>sip.setapi("QDate", 2)<br>sip.setapi("QDateTime", 2)<br>sip.setapi("QTime", 2)<br>from PyQt4.QtCore import *<br>import datetime<br>
locale = QLocale()<br>locale.toString(datetime.datetime.now(), locale.dateTimeFormat())<br># returns u'Tuesday, 20 April 2010 HH:mm:ss '<br><br>