我有这个日期在PHP中:31/01/2013PHP日期不正确转换
我想使用的strtotime功能,像这样
date("Y-m-d", strtotime(31/01/2013));
将它转换,但它继续显示为1970年-01-01。任何知道这是为什么?
我有这个日期在PHP中:31/01/2013PHP日期不正确转换
我想使用的strtotime功能,像这样
date("Y-m-d", strtotime(31/01/2013));
将它转换,但它继续显示为1970年-01-01。任何知道这是为什么?
这将工作
$date = str_replace("/", "-", "31/01/2013");
echo date("Y-m-d", strtotime($date));
你应该包括一个字符串,而不是内部的一系列连续的分度号的
date("Y-m-d", strtotime("31/01/2013"));
试试这个
$date = "31/01/2013";
$date = date("Y-m-d", strtotime($date));
希望这将有助于
试试这
$date = "01/08/2013";
echo date('Y-m-d', $date);
'strtotime'需要一个字符串 - 不是一个数字。 –
31除以01除以2013等于0.0153999006458023,投射为整数0;这是1970年1月1日格林尼治标准时间00:00的unix时间戳 –