sandy1028 Posted January 22, 2008 Share Posted January 22, 2008 Hi, How to find the hour from current time to previous 1 day interval. Quote Link to comment https://forums.phpfreaks.com/topic/87205-time-interval/ Share on other sites More sharing options...
themistral Posted January 22, 2008 Share Posted January 22, 2008 Take a look at this function - should be a help! http://uk2.php.net/strtotime Quote Link to comment https://forums.phpfreaks.com/topic/87205-time-interval/#findComment-446046 Share on other sites More sharing options...
sandy1028 Posted January 22, 2008 Author Share Posted January 22, 2008 Hi, The code below displays the time from 0th hour to cur time. Please help me to find the time from curtime to previous 24 hours. Suppose if the time is 05:23 how to set the time to 05:20. I want all the miutes and hours of the 1 day interval from now() 05:00,04:50,04:40...................................... Please help me with this $t= time(); $timetostop=mktime(0,0,0,date("m"),date("d")-1,date("y")); $timetostop=date("m-d-Y",$timetostop); $date=date("m-d-Y",$t); while($date != $timetostop) { echo ' '.date("m-d-Y H",$t); $t=$t-600; $date=date("m-d-Y",$t); } Quote Link to comment https://forums.phpfreaks.com/topic/87205-time-interval/#findComment-446063 Share on other sites More sharing options...
sasa Posted January 22, 2008 Share Posted January 22, 2008 try <?php $t = time(); $t = floor($t/600)*600; for ($i = 0; $i < 24 * 6; $i++){ echo date('H:i', $t - $i * 600), "\n"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/87205-time-interval/#findComment-446113 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.