# get the seconds since epoch my $epoch = timegm(0,0,0, $mday, $mon, $year); # calculate the number of epoch seconds since requested days ago my $past_epoch = $epoch - $epoch_offset; # get the date of X (requested) days ago my $past_date = gmtime($past_epoch);