Unix时间戳轮到午夜 [英] unix timestamp round to midnight

查看:109
本文介绍了Unix时间戳轮到午夜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个随机的unix时间戳,如何将其舍入到今天的午夜或用户选择的午夜.原因是我想在某天的午夜之后添加小时和分钟.

If I have a random unix timestamp, how can I round it down to today's midnight or the midnight selected by the user. The reason for this is that I want to add hours and minutes after a certain day's midnight.

例如,如果时间戳记为1324189035,那么我该如何删除小时,分钟和秒,将时间戳记为当天的午夜.

For example if the timestamp is 1324189035 then how can I remove the hours, minutes, and seconds to put the timestamp at midnight for that day.

推荐答案

echo date('d-m-Y H:i:s', strtotime('today', 1324189035));

这篇关于Unix时间戳轮到午夜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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