strftimedoesnt display year correctly
- by paultop6
Hi guys, i have the following code below:
const char* timeformat = "%Y-%m-%d %H:%M:%S";
const int timelength = 20;
char timecstring[timelength];
strftime(timecstring, timelength, timeformat, currentstruct);
cout << "timecstring is: " << timecstring << "\n";
currentstruct is a tm*. The cout is giving me the date in the correct format, but the year is not 2010, but 3910. I know there is something to do with the year cound starting at 1900, but im not sure how to get strftime to recognise this and not add 1900 to the value of 2010 that is there, can anyone help.
Regards
Paul