有一些strtotime,它更容易用例子来展示:)
date_default_timezone_set('Europe/London'); // Set timezone to local /
echo date("d/m/Y", strtotime("1-6-2003")); // Expected: 01/06/2003 Got: 01/06/2003
echo date("d/m/Y", strtotime("16-12-2003")); // Expected: 16/12/2003 Got: 16/12/2003
echo date("d/m/Y", strtotime("10-12-03")); // Expected: 10/12/2003 Got: 03/12/2010
有什么办法解决这个问题吗?我正在使用strtotime来尝试解决用户以不同格式输入日期的问题。
谢谢你的阅读,
里克。
strtotime
不支持这种日期格式。有关支持的格式列表,请参阅文档。下次请阅读文档