Good day Gentl'men!
Is there a way in c++ to convert a string variable that holds time of format like "17:30" to time_t variable?
Lets say!:
#include<iostream>
#include<ctime>
using namespace std;
int main()
{
time_t timein,timeout;
float timediff;
string stimein,stimeout;
cout<<"Enter time-in: ";
cin>>stimein;
cout<<"Enter time-out: ";
cin>>stimeout;
//convertion from string to time_t here
timediff=difftime(timeout,timein);
cou<<timediff<<endl;
return 0;
}
Thank you!