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?
尝试这个:
echo date("M, d", strtotime($from));
<?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”以从输出中删除年份。