PDA

View Full Version : get date



mmm286
17th February 2010, 08:20
Hi,

I have a QCalendarWidget and when I select a date, I would like to get the date like : 16-02-10. But when I get the selectDate() it shows me: "mar 16 feb 2010".

How could I do to get 16-02-10 instead "mar 16 feb 2010"??

Many thanks and sorry for my english!

navi1084
17th February 2010, 08:24
selectedDate() returns you the QDate. There is a toString() function in QDate which returns you the date in the specified format. Hence you can use:

selectedDate().toString("dd-mm-yy")

mmm286
17th February 2010, 09:18
Many thanks!
Is solved!!