rockowtham — 2010-10-27T05:31:59-04:00 — #1
my question is how can i select the row in a particular given time span.
i.e if my date field is having the entry as 2010:10:27 10:30:00 then that row should be selected when the current time reaches 2010:10:27 10:00 and until the current time reaches the 2010:10:27 18:30:00 . like that. Any help on this would do a great benefits for me..
thanks in advance
spikez — 2010-10-27T05:57:15-04:00 — #2
Thread moved to MySQL forum
r937 — 2010-10-27T06:04:39-04:00 — #3
let me see if i understand your requirements...
you want the query to return 10:30 but only between 10:00 and 18:30?
i'm sorry, i don't understand
jurn — 2010-10-27T06:22:21-04:00 — #4
You can use now(), to get the current datetime
and the function date_add() to add to datetimes.
e.g. maybe something like
where date_field between
date_add(now(), interval 30 minute)
date_add(now(), interval 8 hour)