Assuming I have a unix timestamp in PHP. How can I round my php timestamp to the nearest minute? E.g. 16:45:00 as opposed to 16:45:34?
Thanks for your help! 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the timestamp is a Unix style timestamp, simply
If it is the style you indicated, you can simply convert it to a Unix style timestamp and back
round()is used as a simple way of ensuring it rounds toxfor values betweenx - 0.5 <= x < x + 0.5. If you always wanted to always round down (like indicated) you could usefloor()or the modulo function