note 73990 deleted from function.checkdate by bobby
| From: | bobby@php.net | Date: | Thu, 22 Mar 2007 15:43:29 +0000 |
| Subject: | note 73990 deleted from function.checkdate by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-124724@lists.php.net to get a copy of this message | ||
Note Submitter: Dbl K
----
Check_date is very useful to calculate the previous day.
<?php
function previous_day(){
$d_y=date(d)-1;
$m_y=date(m);
$y_y=date(Y);
while(!checkdate($m_y, $d_y, $y_y)){
if($d_y==0){
$d_y=31;$m_y--;
if($m_y==0){$m_y=12;$y_y--;}
}
$d_y--;
}
return $d_y."-".$m_y."-".$y_y;
}
?>