I'm using DateTime::createFromFormat
in PHP like this:
$month = DateTime::createFromFormat("Y-m-d", '2014-08-01');
But echo $month
is showing up as 08. How can I display it as a 3 letter name, i.e.: Aug?
I'm using DateTime::createFromFormat
in PHP like this:
$month = DateTime::createFromFormat("Y-m-d", '2014-08-01');
But echo $month
is showing up as 08. How can I display it as a 3 letter name, i.e.: Aug?
收起
Use capital M instead of m .
$getMonth = DateTime::createFromFormat("Y-m-d", '2014-08-01');
If you already have the date variable created then you can use directly the below code
$month = $getMonth->format('M');
报告相同问题?