in reply to Date Manipulation Calculation Question

As duff points out time will give you the time in seconds since the epoch so it is easy to add or subtract whatever you want. gmtime and its friend localtime convert epoch seconds into all the date bits when called in list context or a nice human readable string when called in scalar context.

my $epoch = time(); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($epo +ch); my $gm_str = gmtime(); # note that default epoch for gmtime is NOW() printf '%d seconds ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = %s %s %s ', $epoch, "($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)", $g +m_str, scalar(localtime); # need scalar(localtime) as print has list context __DATA__ 1099351947 seconds ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = (27,32,23,1,10 +,104,1,305,0) Mon Nov 1 23:32:27 2004 Tue Nov 2 10:32:27 2004

cheers

tachyon