note 65239 deleted from function.getdate by bobby

From: Date: Fri, 08 Sep 2006 15:01:00 +0000
Subject: note 65239 deleted from function.getdate by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-116921@lists.php.net to get a copy of this message
Note Submitter: king_of_t3rrors at hotmail dot com ---- This is a correction of the note posted on 27-Feb-2006 03:29: "Simple routine for determining whether some date given in MySQL format (yyyy-mm-dd) has gone past." I think that code was wrong. My code is: function is_past( $date,$format ) // When calling this function remember: // $date format: yyyy-mm-dd // $format--> insert 'ymd' as second argument { $today = getdate() ; $datebits=explode('-',$date); $year = intval($datebits[strpos($format, 'y')]); $mon = intval($datebits[strpos($format, 'm')]); $today = intval($datebits[strpos($format, 'd')]); if ( $today['year'] > $year ) { return false ; } if ( $today['mon'] > $mon ) { return false; } if ( $today['mday'] > $today ) { return false; } return true; }

« previous php.notes (#116921) next »