time_t a1 = std::time(NULL); // it take the currect time,day,year, ect..
Ok, But how i can add 30 days on this?
Thanks in Advance ]
time_t a1 = std::time(NULL); // it take the currect time,day,year, ect..
Ok, But how i can add 30 days on this?
Thanks in Advance ]
Two little notesCode:#include <ctime> #include <iostream> int main() { std::time_t a1 = std::time(NULL); struct tm * timeinfo; a1 += 24*60*60*30;//hours*minutes*seconds*days timeinfo = localtime ( &a1 ); std::cout << asctime(timeinfo); return 0; }
It really takes just seconds elasped since some time in 1970it take the currect time,day,year, ect..
And a better variable name then a1 would probably be good
Last edited by MadCow257; 01-12-2006 at 07:53 PM.
Thanks for help
i thought it was going to be something like, 'about time.. somebody answered my damn question'..lol
This isn't the easiest to read, but it brings up some potential issues:
Time/Date Calculations
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*