0

im trying to add 15 minutes to the current time and list it. but i need show it like below

15:30 
15:45 
16:00
16:15....

i used the below code

for($i = 15; $i <= 90; $i+=15)
        {   
            echo date("H:i",strtotime('+'.$i.' minutes'))."<br>";

        }

but i get the time like this

 15:24 
 15:39 
 15:54 
 16:09 
 16:24
 16:39

how can i round the minutes to be like 15,30, 45...?

LiveEn
  • 3,193
  • 12
  • 59
  • 104
  • 1
    http://stackoverflow.com/questions/2480637/round-minute-down-to-nearest-quarter-hour – Nabin Kunwar Feb 29 '16 at 15:28
  • I think the best way is to round the first date and after add 15 minutes. And not to round each time the date that you have calculate. Just for the performance and rapidity of your code. – Berserk Feb 29 '16 at 15:36

0 Answers0