I am receiving a date structure in "24-9-2016 13:30" format. Now I want to convert time value to specific timezone, I am doing calculations and have number of hours to add or substract.
So I don't know: how can I initialize tm struct with the date value I have? how to add or substract hours in tc struct variable to get required date?
my intention is
Date received "24-9-2016 13:30" and 5 Hours to add so final Date: "24-9-2016 18:30"
1 2 3 4 5 6 7 8 9 10 11 12
//Temporarily init time to local
time_t tempTime
time(&tempTime);
struct tm *initStruct = localtime(&tempTime);//initialize it with local time
//now modify it to user defined date
initStruct ->tm_year = 2016;
initStruct->tm_mon = 9;
initStruct->tm_hour = 13;
.
.
.
//Not sure how can I subtract or add hours in this struc to get desired date value