note 20279 deleted from ref.datetime by cece

From: Date: Wed, 20 Aug 2003 13:45:37 +0000
Subject: note 20279 deleted from ref.datetime by cece
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-54754@lists.php.net to get a copy of this message
Note Submitter: m.bouquet@wanadoo.fr ---- Corrections about add months of "Some general date functions" in these notes function sub($timestamp, $seconds,$minutes,$hours,$days,$months,$years) { $mytime = mktime(1+$hours,0+$minutes,0+$seconds,1,1+$days,1970+$years); $times=$timestamp - $mytime; if ($months!=0) { $year=date('Y',$times)*12+date('n',$times)*1; $year2=$year-$months; $year3=floor($year2/12); $month3=abs($year2-$year3*12); $times=mktime (date('H',$times),date('i',$times),date('s',$times), $month3,date('j',$times),date('Y',$times)); } return $times; } function add($timestamp, $seconds,$minutes,$hours,$days,$months,$years) { $mytime = mktime(1+$hours,0+$minutes,0+$seconds,1+$months,1+$days,1970+$years); $times=$timestamp + $mytime; if ($months!=0) { $year=date('Y',$times)*12+date('n',$times)*1; $year2=$year+$months; $year3=floor($year2/12); $month3=abs($year2-$year3*12); $times=mktime (date('H',$times),date('i',$times),date('s',$times), $month3,date('j',$times),date('Y',$times)); } return $times; }

« previous php.notes (#54754) next »