Reputation: 51
I have a QDateEdit
object (field on a display window). When I use the only real option (according to the PySide site) QDateEdit.date()
I get "2000, 1, 1" instead of "1/1/2000" and the documentation is completely useless for telling what to do with this data to use it as a real date. "2000, 1, 1" isn't a real date.
How to make this a date I can actually use and why I can't use any of the attributes described on the PySide site under QDate
, QDateEdit
, or QDateTimeEdit
?
Upvotes: 0
Views: 1969
Reputation: 1348
I am having a hard time trying to determine what you mean by "real date", but here is my idea of what you could want:
# QDateEdit's .date() returns a QtCore.QDate object
date = QtCore.QDate(2013, 1, 1)
# Get the string in whatever format you want
date.toString("MM/dd/yyyy")
Out[10]: u'01/01/2013'
# Get the date as a datetime object
date.toPython()
Out[11]: datetime.date(2013, 1, 1)
I got all of this from the PySide wiki
Upvotes: 1