Link to home
Start Free TrialLog in
Avatar of kpy
kpy

asked on

Date manipulation

How can I manipulate the date.
eg:   how can I add days to the current system date?
Avatar of ozo
ozo
Flag of United States of America image

to change the system date, as super user:
date dammddHHMMccyy
If you want to find tomorrows date (and it's not near midnight the day before a daylight savings time switch)
you can add 86400 to time(2) before calling localtime(3)

time_t t;
char *c;
t = time(NULL);
t += 60*60*24;
c = asctime(localtime(&t));

Avatar of ecw
ecw

perl5:
perl -e 'print scalar(localtime(time + 60 * 60 * 24)), "\n"';
ASKER CERTIFIED SOLUTION
Avatar of almasy
almasy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial