Php 将2017-03-01转换为2017年3月1日格式的INPPP
如何用PHP将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); 上面的代
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
,检查可能重复的