DateTime :: createFromFormat月份名称[关闭]

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');