从 PHP 的 strtotime 函数中删除 hh:mm:ss


Removing hh:mm:ss from PHP's strtotime function

我正在设置一个HighCharts折线图,x轴标签与数据点不匹配。数据点汇总到一整天(无小时)。但是,当我添加pointStart时,我获得了运行它的unix时间戳:

pointStart: <?php echo strtotime("-1 month -1 day") * 1000; ?>

我可以说"给我一个月和一天前午的 unix 时间戳"而不会使事情复杂化吗?

当然你可以:

<?php echo strtotime(date('Y-m-d', strtotime("-1 month -1 day"))); ?>

date()格式将删除小时分秒,然后您可以重新获取时间戳