Reputation: 1935
I am trying to add a date to a QDate object. The month and day are placed into the Qdate object correctly but the year always reads back -4713.
Here is my code:
int main(int argv, char *argc[])
{
// Show all my arguments to make sure they are correct
qDebug() << "\n";
for( int i = 0; i < argv ; i++)
{
qDebug() << i << ": " << argc[i] << "\n";
}
// Add the yyyy-mm-dd date into date
QDate date = QDate::fromString(argc[1],"yyyy-mm-dd");
// Check to see if the date is correct
qDebug() << "Year: " << date.year() << "\nMonth:" << date.month() << "\nDay" << date.day();
return 0;
}
Here is what I use in the terminal:
./birthday "1992-01-01"
The output looks like this:
0 : ./birthdays
1 : 1990-01-01
Year: -4713
Month: 1
Day: 1
Now no matter what I choose for my year it always returns -4713. Does anyone know why? I have been stuck on this issue for a while now and do not understand what is going on here.
Upvotes: 0
Views: 503