note 20279 added to ref.datetime

From: Date: Thu, 28 Mar 2002 13:21:56 +0000
Subject: note 20279 added to ref.datetime
Groups: php.notes 
Request: Send a blank email to php-notes+get-28333@lists.php.net to get a copy of this message
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; } -- http://www.php.net/manual/en/ref.datetime.php http://master.php.net/manage/user-notes.php?action=edit+20279 http://master.php.net/manage/user-notes.php?action=delete+20279 http://master.php.net/manage/user-notes.php?action=reject+20279

« previous php.notes (#28333) next »