如何从 PHP 中的日期中删除时间,例如:
20170803173418 我想花 4 分 13 秒的时间来获取新的日期戳,即 20170803173005
我需要使用什么代码才能获得这个?
编辑
我目前有:
$dbTime = $row['aptDeadline']; // This is the appointment end time stored in DB
$dbTime = new DateTime($dbTime);
$currentTime = date("YmdHis"); // This is the current time
$currentTime = new DateTime($currentTime);
$counterTime = $row['aptDeadline']; //This is the time a countdown clock works from inDB
$counterTime = new DateTime($counterTime);
$difference = $currentTime->diff(new DateTime($dbTime)); // Calculate the time between now and the apt time in the db
我现在需要一些代码,如果 $difference 为正,可以将这个数字从 $counterTime 标记中删除