php 下一年的日期和 strtotime return 今年
php date and strtotime for next year return current year
我遇到了一个小问题。检查下面的代码
echo date('Y-m-d', strtotime('15 Nov, 2018'));
我原以为它会 return 2018-11-15 但是当我回显结果时 returns 2016-11-15,
谁能告诉我这是什么问题。
提前致谢
尝试删除逗号:echo date('Y-m-d', strtotime('15 Nov 2018'));
在此处详细了解支持的格式:strtotime
11 月后删除逗号
echo date('Y-m-d', strtotime('2018 年 11 月 15 日'));
它会给你正确的结果
这是因为逗号。删除逗号后以下工作正常:
echo date('Y-m-d', strtotime(str_replace(',','','15 Nov, 2018')));
我遇到了一个小问题。检查下面的代码
echo date('Y-m-d', strtotime('15 Nov, 2018'));
我原以为它会 return 2018-11-15 但是当我回显结果时 returns 2016-11-15,
谁能告诉我这是什么问题。 提前致谢
尝试删除逗号:echo date('Y-m-d', strtotime('15 Nov 2018'));
在此处详细了解支持的格式:strtotime
11 月后删除逗号
echo date('Y-m-d', strtotime('2018 年 11 月 15 日'));
它会给你正确的结果
这是因为逗号。删除逗号后以下工作正常:
echo date('Y-m-d', strtotime(str_replace(',','','15 Nov, 2018')));