//date subb, format "day.month.year hour:minutes:seconds"
//$unit can be: hr, min, sec, mon, day, year
//$amount is integer
function DateSub($data, $unit, $amount\)
{
list($arr1, $arr2)=explode(" ", $data);
list($day,$month,$year)=explode(".",$arr1);
list($hour,$minute,$second)=explode(":",$arr2);
$timestamp=mktime ($hour,$minute,$second,$month,$day,$year);
$datecomp = array("hr"=>0, "min"=>0, "sec"=>0, "mon"=>1, "day"=>1,"year"=>1970);
$datecomp[$unit] += $amount;
$diff = gmmktime($datecomp["hr"], $datecomp["min"], $datecomp["sec"], $datecomp["mon"], $datecomp["day"], $datecomp["year"]);
$newValue=$timestamp - $diff;
$newData=date("d.m.Y H:i:s", $newValue);
return $newData;
}