I'm trying to think of ways to get the php timestamp when a user clicks a button and then rounding that number to the nearest quarter hour ie. 8:00, 8:15, 8:30 and so on.

Basically I am clueless how to go about doing this. Any advice is greatly appreciated.

    HI,
    you can do round(x/15)*15. This give you the nearest quarter...

     
    // this is to find 15 minute timestamp...
    $quote=mktime(0,30,0,1,1,0)-mktime(0,15,0,1,1,0);
    
    //get a time
    $thistime=mktime(0,8,10,11,12,2003);
    
    //round to the nearest quarter...
    $thistime=round($thistime/$quote)*$quote;
    

    I hope this helps...

      Awesome, that's definitely a huge help. Thanks a bunch.

        Write a Reply...