LPM: Test / question on date stuff
Mike Andrews
mandrews at bit0.com
Wed Feb 9 10:10:11 CST 2000
On Wed, 9 Feb 2000, Carl Rose wrote:
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
> = localtime(time);
> $mon += 1;
> $year = $year +1900;
>
> print "$mon/$mday/$year \n";
>
> It of course returns the date just like I want it
> (02/09/2000). So what code do I issue to get 28 days
> from now added onto the day and get the correct
> rollaround. (ie when you add 28 above you get Feb 37th
I'd add 28 days worth of seconds to 'time' and have localtime just return
that:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
= localtime(time+2419200);
(60 secs * 60 mins * 24 hours = 86400 seconds, * 28 days = 2419200)
Mike Andrews (MA12) * mandrews at dcr.net * http://www.bit0.com/
VP, sysadmin, & network guy, Digital Crescent Inc, Frankfort KY
Internet services for Frankfort, Lawrenceburg, Owenton, Shelbyville
"Don't sweat the petty things, and don't pet the sweaty things."
More information about the Lexington-pm
mailing list