Php 删除一个月后,strotime返回1970?
根据,我正确地使用了strotime,但显然我设法弄错了什么 以下代码:Php 删除一个月后,strotime返回1970?,php,strtotime,Php,Strtotime,根据,我正确地使用了strotime,但显然我设法弄错了什么 以下代码: echo date("Y,n,j", strtotime($event["StartDate"])); 输出:2013,4,18(哪个是正确的) 鉴于以下代码(使用完全相同的数据): 输出:1969,12,1(而不是2013,3,18) 为什么?回显日期(“Y,n,j”,标准时间('-1个月),标准时间($event[“StartDate]”))回显日期(“Y,n,j”,标准时间('-1个月),标准时间($event[“
echo date("Y,n,j", strtotime($event["StartDate"]));
输出:2013,4,18
(哪个是正确的)
鉴于以下代码(使用完全相同的数据):
输出:1969,12,1
(而不是2013,3,18
)
为什么?
回显日期(“Y,n,j”,标准时间('-1个月),标准时间($event[“StartDate]”))代码>回显日期(“Y,n,j”,标准时间('-1个月),标准时间($event[“StartDate]”))
您是否需要在另一个strotime调用中包装$event['StartDate']
?为了避免潜在的歧义,最好使用ISO 8601(YYYY-MM-DD)在另一个strotime调用中是否需要包装$event['StartDate']
?为了避免潜在的歧义,最好使用ISO 8601(YYYYYY-MM-DD)
echo date("Y,n,j", strtotime('-1 month', $event["StartDate"]));