tibberous Posted June 3, 2010 Share Posted June 3, 2010 I am programming a site that processes orders. Orders after 6:00 are processed the next day. My client wants a screen that lists "Todays Orders", which are really the orders from 6:00pm yesterday to the present. Any ideas? I'm stumped on this one. Quote Link to comment https://forums.phpfreaks.com/topic/203723-selecting-all-records-from-600pm-on/ Share on other sites More sharing options...
andrewgauger Posted June 3, 2010 Share Posted June 3, 2010 $begin=mktime(18, 0, 0, date("m") , date("d")-1, date("Y")); $end=$begin+86400; You might have to throw these at date() to get them formatted for your SQL query. Quote Link to comment https://forums.phpfreaks.com/topic/203723-selecting-all-records-from-600pm-on/#findComment-1067036 Share on other sites More sharing options...
sniperscope Posted June 3, 2010 Share Posted June 3, 2010 <?php if(date("H:i:s") < '18:00:00'){ $nextday = 1; }else{ $nextday = 0; } $i = mktime(0, 0, 0, date("m"), date("d")-$nextday, date("Y")); ?> it may help you. Quote Link to comment https://forums.phpfreaks.com/topic/203723-selecting-all-records-from-600pm-on/#findComment-1067043 Share on other sites More sharing options...
dabaR Posted June 3, 2010 Share Posted June 3, 2010 Here is an example: "SELECT * FROM orders where order_time between '" . date('Y-m-d 18:00:00', strtotime('yesterday')) . "' AND '" . date('Y-m-d 18:00:00', strtotime('today')) . "';" This is basically same as andrewgauger was saying, but complete and a little clearer, IMHO. Quote Link to comment https://forums.phpfreaks.com/topic/203723-selecting-all-records-from-600pm-on/#findComment-1067062 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.