3
I need to convert an input date by a Qcalendar to datetime (from lib datetime). How can I do it?
3
I need to convert an input date by a Qcalendar to datetime (from lib datetime). How can I do it?
3
The Qdatetime has a function toPyDateTime that returns an object datetime pattern
from PyQt5.QtCore import QDate, QDateTime
#usando Date
QDate.currentDate().toPyDate()
datetime.date(2017, 3, 17)
#usando DateTime
QDateTime.currentDateTime().toPyDateTime()
datetime.datetime(2017, 3, 17, 19, 9, 45, 974000)
Browser other questions tagged python python-3.x pyqt-5
You are not signed in. Login or sign up in order to post.
Right, I tried that and returned that exception: Except: 'Qdate' Object has no attribute 'toPyDateTime'
– Matheus
You are using Pyqt5 or Pyside?
– Marquezani
I am using Pyqt5!
– Matheus
I saw that in your error you use Qdate along with toPyDateTime but in fact it only supports toPyDate. Take a look at the code above that I edited
– Marquezani