PHP将round time()向上(未来)到5分钟的下一个倍数 [英] PHP round time() up (future) to next multiple of 5 minutes

查看:240
本文介绍了PHP将round time()向上(未来)到5分钟的下一个倍数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将time()的结果四舍五入(朝着未来)至下一个5分钟的倍数?

How do I round the result of time() up (towards the future) to the next multiple of 5 minutes?

推荐答案

 $now = time();     
 $next_five = ceil($now/300)*300;

这将给您下一轮五分钟(始终大于或等于当前时间).

This will give you the next round five minutes (always greater or equal the current time).

根据您的描述,我认为这就是您所需要的.

I think that this is what you need, based on your description.

这篇关于PHP将round time()向上(未来)到5分钟的下一个倍数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆