note 62384 deleted from function.getdate by bobby

From: Date: Fri, 08 Sep 2006 14:58:55 +0000
Subject: note 62384 deleted from function.getdate by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-116920@lists.php.net to get a copy of this message
Note Submitter: ---- Simple routine for determining whether some date given in MySQL format (yyyy-mm-dd) has gone past. E.g., has a membership expired or a special offer gone stale. function is_past( $date ) { $today = getdate() ; $yyyy = intval(substr($date,0,4)) ; $mm = intval(ltrim(substr($date,5,2),'0')) ; $dd = intval(ltrim(substr($date,8,2),'0')) ; if ( $today['year'] > $yyyy ) return true ; if ( $today['year'] < $yyyy ) return false ; if ( $today['mon'] > $mm ) return true ; if ( $today['mon'] < $mm ) return false ; if ( $today['mday'] > $dd ) return true ; return false ; }

« previous php.notes (#116920) next »