-3

I have a PHP code that will display the date format which is

{{date('F d, Y', strtotime($po->due_date))}}

and it will output something like "September 02, 2016", how can I format this date into "Sep 02, 2016"?

Sergey
  • 2,880
  • 3
  • 19
  • 29
  • 2
    Did you try and google it? Perhaps googling the function you are using? I know for a fact that you would find the answer in php's own docs. – Epodax May 30 '16 at 08:19
  • 2
    Search http://docs.php.net/manual/en/function.date.php for "A short textual representation of a month, three letters" – VolkerK May 30 '16 at 08:19

1 Answers1

0

It's M d, Y. I would recommend you to add due_date to $dates property in your model:

/**
 * The attributes that should be mutated to dates.
 *
 * @var array
 */
protected $dates = [
    'due_date',
];

Then you can display it $po->due_date->format('M d, Y') instead of date('M d, Y', strtotime($po->due_date))

Rifki
  • 3,440
  • 1
  • 18
  • 24