Re: Finding records within 15 minutes from now?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, April 12, 2005 12:33 pm, J J said:
> I'm struggling with the php or mysql query to find
> records within my database that are within 15 minutes
> from now and prior.
>
> Example:
> It's 2:30pm on 4/12/05
>
> I need to find all records with a RecordTime of 2:45pm
> and previous.
>
> So it should find:
> rec1 time: 2:45 date: 4/12/05
> rec2 time: 2:00 date: 4/12/05
> rec3 time: 1:30 date: 4/8/05
> etc.
>
> It would not find:
> rec4 time: 3:15 date: 4/12/05
> rec5 time: 4:00 date: 4/23/05

If RecordTime does not contain the DATE as well, as I suspect, then you
need to add/combine the two fields (date & time) before you compare to
'now()' with date_add() and INTERVAL.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux