I have a QDateEdit
in my GUI from which I convert the QDate
to QString
and add it to my database. The QString
date is saved in the database in this format: 20/12/2015.
In case a user want to edit the date, then I need to show the date on the QDateEdit
field on the GUI again. Hence, I need to fetch the database, bring back the date (which is in QString
format) and convert it to QDate
back again in order to put it on the QDateEdit
field on the GUI.
However, I cannot manage to convert that QString
format (i.e.: 20/12/2015) to QDate
using the following:
QString date_string_on_db = "20/12/2015";
QDate Date;
Date.fromString(date_string_on_db,"dd/MM/YYYY");
The Date
is always returning invalid
.
what should I do ?