我试图使用date_create_from_format()从字符串中解析日期。日期字符串如下所示:Sun 5月1日 我期待这个工作
$dateFromString = date_create_from_format("D jS M", "Sun 5th Jan");
不起作用,有人知道为什么吗?
答案 0 :(得分:0)
这只是格式..你需要使用它!
<?php
$dateFromString = date_create_from_format("D jS M", "Sun 5th Jan");
echo $dateFromString->format('Y-m-d H:i:s');