I have a time like this 2013-08-12 12:58:14. Now I want hour so I use following code:
$date = "2013-08-12 12:58:14";
$date = strtotime($date);
$hour = date('H', $date);
So I get $hour=12; now I have a other parameter $tohour=5 (it is user defined which value is between 1 to 24); now 12-5=7 means fetch data between time 7 to 12.
Another example:
Suppose time is 2013-08-12 01:15:23 and $tohour=10.
Now this time the data fetch between 2013-08-11 15:15:23 to 2013-08-12 01:15:23.
So how to achieve it? I try to explain my question, but if it is not clear, please let me know or fill free to edit my question and title too.