c++ - QDate::FromString() issue with QDate.year() always returning -4713 -
i trying add date qdate object. month , day placed qdate object correctly year reads -4713.
here code:
int main(int argv, char *argc[]) { // show arguments make sure correct qdebug() << "\n"; for( int = 0; < argv ; i++) { qdebug() << << ": " << argc[i] << "\n"; } // add yyyy-mm-dd date date qdate date = qdate::fromstring(argc[1],"yyyy-mm-dd"); // check see if date correct qdebug() << "year: " << date.year() << "\nmonth:" << date.month() << "\nday" << date.day(); return 0;
}
here use in terminal:
./birthday "1992-01-01"
the output looks this:
0 : ./birthdays 1 : 1990-01-01 year: -4713 month: 1 day: 1
now no matter choose year returns -4713. know why? have been stuck on issue while , not understand going on here.
maybe varies qt version qt version me string wasn't converted @ until made letters m
- capital "yyyy-mm-dd"
started working (my version 5.1.0)
you may see here. m
s mentioned capital.
Comments
Post a Comment