unix timestamp round to midnight

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 03:02:54
echo date('d-m-Y H:i:s', strtotime('today', 1324189035));

Because of how you're using it, I wouldn't calculate midnight at all: it is far easier to simply convert what you're adding to the timestamp into 24 hour time and then use strtotime:

echo strtotime("0:00",1324189035); // 1324184400
echo strtotime("17:50",1324189035); // 1324248600

And if you want to have that in human readable, use date and m/d/Y H:i:s:

echo date('m/d/Y H:i:s', strtotime('17:50',1324189035)); // 12/18/2011 17:50:00

Simply Use

strtotime('today midnight');

Just do

date('d-m-Y',strtotime('today'));

Easy!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!