PHP Round Minute to nearest Quarter Hour

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-03-19T21:15:37Z Indexed on 2010/03/19 21:21 UTC
Read the original article Hit count: 115

Filed under:
|
|
|

I need to round times down to the nearest quarter hour in PHP. The times are being pulled from a MySQL database from a datetime column and formatted like 2010-03-18 10:50:00.

Example: 10:50 needs to be 10:45 1:12 needs to be 1:00 3:28 needs to be 3:15 etc.

I'm assuming floor() is involved but not sure how to go about it.

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about date