我需要获取本周的周三和周六22:59的时间戳,然后将时间戳转换为人类可读的日期。
我尝试了以下内容:
date_default_timezone_set('America/New_York');
$wednesdayLimit = strtotime('wednesday this week');
$saturdayLimit = strtotime('saturday this week');
$wednesdayLimit->setTime(22,59,0);
$saturdayLimit->setTime(22,59,0);
echo date("Y-m-d H:i:d", $wednesdayLimit);
echo date("Y-m-d H:i:d", $saturdayLimit);
但是我收到以下错误:
未捕获错误:在整数
上调用成员函数setTime()
答案 0 :(得分:1)
一个班轮:
print date('Y-m-d H:i:s', strtotime('wednesday this week 22:59:00'));¸
收率:
2016-01-27 22:59:00
答案 1 :(得分:0)
怎么样
$wednesday = strtotime('wednesday this week');
$wednesdayStart = $wednesday - ($wednesday % 60*60*24);
$wednesdayEnd = $wednesdayStart + (60 * 60 * 24) - 1;
答案 2 :(得分:0)