I understand there' a function mktime() which can help me convert from tm to time_t, then i can calculate difference in seconds. But i have a unique situation here... A user shoul be able to enter two dates (start - end) manually in the format (month/day/year hour:minutes:seconds) ... Then is should first be able to convert from these start/end format to tm structure .. This is where my problem is...
Here's my attempt though
Code:
struct tm issueDate;
struct tm returnDate;
/***
**
* Convert from normal date to TM structure
**
***/
std::ostringstream issue_dymonyr, return_dymonyr;
std::ostringstream issue_hrminsec, return_hrminsec;
issue_dymonyr << issue_dt.getMonth() << "/" << issue_dt.getDay() << "/" << issue_dt.getYear();
return_dymonyr << return_dt.getMonth() << "/" << return_dt.getDay() << "/" << return_dt.getYear();
issue_hrminsec << issue_dt.getHour() << ":" << issue_dt.getMinute() << ":" << "0";
return_hrminsec << return_dt.getHour() << ":" << return_dt.getMinute() << ":" << "0";
strptime(issue_dymonyr.str()+" "+issue_hrminsec.str(), "%D %T", &issueDate);
strptime(return_dymonyr.str()+" "+return_hrminsec.str(), "%D %T", &returnDate);
I have an error here, says : "error C3861: 'strptime': identifier not found" .. i have #include <time.h> added