Re: between timestamps

From: Date: Sat, 28 Feb 2004 20:47:59 +0000
Subject: Re: between timestamps
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-179090@lists.php.net to get a copy of this message
On Sat, 2004-02-28 at 14:59, Ryan A wrote: > Hey everyone... > In the last 24 hours there have been questions on how to get the all the > records of a day > based on the timestamp and to check whether the current date/time is later > than a timestamp, > I have a new one... how do you fetch all records between date1 and date2? > > eg: > you have some entries in a join_date (timestamp(4)) field for every day of > Feb and need to > get all records between sayyy... 7th Feb and 15th Feb.. There are many ways to go about this, here is one... $qString = "SELECT * from your_table " ."WHERE TO_DAYS( db_date ) >= TO_DAYS( '$sDate' ) " ."AND TO_DAYS( db_date ) <= TO_DAYS( '$eDate' ) "; Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#179090) next »