Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将2017-03-01转换为2017年3月1日格式的INPPP_Php_Codeigniter - Fatal编程技术网

Php 将2017-03-01转换为2017年3月1日格式的INPPP

Php 将2017-03-01转换为2017年3月1日格式的INPPP,php,codeigniter,Php,Codeigniter,如何用PHP将2017-03-01转换为2017年3月1日格式 $mark_entry_last_date=$exam_dates['last_date']; echo date('M j<\sup>S</\sup> Y', $mark_entry_last_date); $mark_entry_last_date=$exam_dates['last_date']; 回显日期('M jS Y',$mark\u entry\u last\u date); 上面的代

如何用PHP将
2017-03-01
转换为
2017年3月1日
格式

 $mark_entry_last_date=$exam_dates['last_date'];

 echo date('M j<\sup>S</\sup> Y', $mark_entry_last_date);
$mark_entry_last_date=$exam_dates['last_date'];
回显日期('M jS Y',$mark\u entry\u last\u date);
上面的代码只输出当前日期,但我需要$mark\u entry\u last\u date的日期值。如何使用转义字符获得给定日期的结果,如2017年3月1日

函数期望第二个参数是时间戳(整数)而不是字符串,所以您需要使用
strotime

echo date('M j<\s\up>S</\s\up> Y', strtotime($mark_entry_last_date));
echo日期('M jS Y',strotime($mark_entry_last_date));
您还需要为
sup
标记转义
u
。由于
u
是微秒显示格式。

函数要求第二个参数是时间戳(整数)而不是字符串,所以您需要使用
strotime

echo date('M j<\s\up>S</\s\up> Y', strtotime($mark_entry_last_date));
echo日期('M jS Y',strotime($mark_entry_last_date));

您还需要为
sup
标记转义
u
。因为
u
是微秒显示格式。

尝试不带标签,使用
strotime()


要了解更多信息,请尝试不使用标签,并使用strotime()

如需了解更多信息,请使用
strotime()
$mark\u entry\u last\u date
,检查可能重复的用法
strotime()
$mark\u entry\u last\u date
,检查可能重复的