Re: PHP & MySQL DATE comparison

From: Date: Wed, 16 Jun 2004 16:55:14 +0000
Subject: Re: PHP & MySQL DATE comparison
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-188411@lists.php.net to get a copy of this message
"Ryan Schefke" <ryan@triomfgroup.com> wrote in message news:auto-000679346433@front3.chartermi.net... > Hello, > > > > I'm pulling a date in the "datetime" format via a MySQL query. Using PHP I > would like to check if that date is prior to today's date. Can someone > please help with this quick question. You could convert it to a timestamp via strtotime() and check it against time(): $date = strtotime($dateFromDb); if ($date < time()) { echo 'Date is in the past.'; } Regards, Torsten Roehr

« previous php.general (#188411) next »