Strange behavior of Date Function

穿精又带淫゛_ 提交于 2019-12-05 11:51:27

From the manual:

if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.

This is not behavior of the date function but of the strtotime. strtotime can handle only dates in specific formats listed on the Date Formats manual page. 09-september-2012 is in the dd ([ \t.-])* m ([ \t.-])* y format listed there, but 2012-september-09 does not match any of the supported formats.

Ravichandran Jothi

I think in your code,

echo date('Y-m-d',strtotime('2012-september-09'));

strtotime('2012-september-09') is not a valid format ('2012-september-09') for strtotime() date function.

refer this link http://www.php.net/manual/en/datetime.formats.date.php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!