Posted on 2003-10-22
I'm new to C++ and I want to do a little console exercise that seems simple:
I want to introduce a date in string format(year month day hour minute second -2002 03 25 11 34 57). After that I want to convert it to a date. Then I want to add a number of seconds to this date and show on screen the new date.
I tried this using the tm structure to store the input date, then I converted it to long using mktime() then added the number of seconds and converted the new date to date using localtime(). The problem is that it is only working for years between 1970 and 1999.
Can anyone tell me how to make it work for a larger period of time? An example is apreciated.
Thanks in advance!