CodeIgniter Forums
How to select the matching details from table mysql query equal to current date - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: How to select the matching details from table mysql query equal to current date (/showthread.php?tid=35360)



How to select the matching details from table mysql query equal to current date - El Forum - 10-27-2010

[eluser]oldrock[/eluser]
Hi..,


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


How to select the matching details from table mysql query equal to current date - El Forum - 10-27-2010

[eluser]n0xie[/eluser]
Do you mean like this?
Code:
SELECT * FROM `my_table` WHERE date BETWEEN ('2010-10-27 10:30:00') AND ('2010-10-27 18:30:00');