Hi
I have been trying to figure out how to increment a datetime by 1 day. For example 2009-03-31 13:00:00. I managed to write the following code, but I almost knew before I ran it what would happen. It icrements the day to 32 which does not exist obviously.
Is there a way to convert a datetime to unix timestamp, add 86400 seconds, convert back to datetime?Code:#include <stdio.h> #include <time.h> int main() { time_t currentTime; time(¤tTime); struct tm *ptm = localtime(¤tTime); printf("%d\n",(ptm->tm_mday) +1); return 0; }