ambuli
asked on
How to get time_t value that is a week old
Hi there,
How to get a time_t (Unix Time) value that is a week old, month old, day old.
I am getting the current time as below.
How to get a time_t (Unix Time) value that is a week old, month old, day old.
I am getting the current time as below.
time_t current_time;
time(¤t_time);
cout << "Current Time: " << current_time << endl;
ASKER
Thanks. I was thinking of doing the same. But, is there a better way to do this?
Does "better" mean accounting for daylight saving changes and/or month length changes?
ASKER
yes :-)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
current_time-30*24*60*60
current_time-24*60*60
If you need the exactly corresponding time of day across daylight saving changes, or the corresponding day of the month across month length changes, this may need to be modified