I'm having problems with decoding the month and year...
today Sun Oct 31 19:15:01 2010, gives as result da:31,mo:9,ye:110
tm * timeinfo; ctTime = time(NULL); timeinfo = localtime(&ctTime); da=timeinfo->tm_mday; mo=timeinfo->tm_mon; ye=timeinfo->tm_year;
Anybody a solution?
->tm_year is years since 1900
ye=timeinfo->tm_year + 1900;
year is based on 1900 "epoch". Just add 1900 to tm_year to get correct year, i.e. 110+1900 = 2010.
Please log in to post a reply.
mbed, the fastest way to prototype with ARM based microcontrollers.
^ back to top