-6

In my PHP file, date is in this format: "2012-10-09 00:00:00"; I need to show it as "October 9" or "Oct 9" (excluding the year).

How can I achieve this?

4

2 回答 2

4

尝试这个:

echo date("M, d", strtotime($from));
于 2013-06-03T06:47:26.917 回答
3
<?php
$from= "2012-10-09 00:00:00"
echo date('F n Y, strtotime($from)); // n-day, F- full month name, Y-Year 
?>

请查看此链接以供参考: http: //php.net/manual/en/function.date.php 您可以跳过上面的“Y”以从输出中删除年份。

于 2013-06-03T06:46:39.097 回答