note 55593 deleted from ref.datetime by nlopess

From: Date: Tue, 09 Aug 2005 10:37:26 +0000
Subject: note 55593 deleted from ref.datetime by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93299@lists.php.net to get a copy of this message
Note Submitter: office AT universal metropolis . com ---- To easily circument the silly pre-1970 and post-2037 restrictions of shortsighted PHP in date(), mktime() and strtotime(), you can find somebody's birthday or other date in the past, if born before 1970, like this: // example birthdate - my dad's $birthdate="1951-06-09"; // birthdate is before 1970 if($birthdate<'1970-01-01'){ // break pieces apart $birthdate=explode("-",$birthdate); // piece together formatted date based on year 2037 - this will find month and day $birthdate=date("F j",strtotime("2037-$birthdate[1]-$birthdate[2]")) . ", $birthdate[0]"; // note that actual birthdate is appended to the end // birthdate 1970 and upwards, format normally }else{ $birthdate=date("F j, Y",strtotime($birthdate)); }

« previous php.notes (#93299) next »