Re: Selecting all records between a date range

From: Date: Thu, 02 Oct 2008 18:01:11 +0000
Subject: Re: Selecting all records between a date range
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-281408@lists.php.net to get a copy of this message
Jason Pruim wrote: > > On Oct 2, 2008, at 12:39 PM, Per Jessen wrote: > >> Jason Pruim wrote: >> >>> Hi Everyone, >>> >>> I am working on a app where I need to be able to select all the values >>> from a database where the 'timein' field is between a certain date >>> range... Essentially the last 7 days... >>> >> >> SELECT * FROM timeStore WHERE timein>DATE_SUB(now(),INTERVAL 7 DAYS) > > Hmmm... To do that, I'd have to store the date/timestamps in a different > format... > > I'll look into this more, but I think I'd have to rewrite the program to > make that work. > > Thanks for the suggestion though! > Ummm.... you could always add this... http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_unix-timestamp SELECT * FROM timeStore WHERE timein>UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL 7 DAYS)) -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare

« previous php.general (#281408) next »