【发布时间】:2016-12-26 08:20:20
【问题描述】:
如何获取 Unix 时间戳格式的昨天时间?
例如,我想获取昨天的开始时间:
2016:12:25 00:00:00
【问题讨论】:
标签: php unix-timestamp strtotime
如何获取 Unix 时间戳格式的昨天时间?
例如,我想获取昨天的开始时间:
2016:12:25 00:00:00
【问题讨论】:
标签: php unix-timestamp strtotime
这将为您提供昨天的时间
昨天的日期
echo "Yesterday date".time() - 86400; //this will take current time
给定日期的最后一天
$inputedDate = "2016:12:25 00:00:00"; // you can pass date you want
$yesterdayDate = date ("Y-m-d H:i:s",strtotime($inputedDate)-86400);
echo $yesterdayDate;
【讨论】:
您只需在格式后将 strtotime('-1 day', strtotime('datetime')) 传递给您的 date() 函数即可将其减去 1 天
echo date( 'U', strtotime('-1 day', strtotime('2016:12:25 00:00:00')) );
【讨论】: