Reputation: 626
I'm using Laravel. I get the following error when trying to display a date:
A textual month could not be found Trailing data
Format is j M Y
, date is 2014-12-13 10:00:00
I don't get where is the error.
Any toughts?
Upvotes: 1
Views: 6603
Reputation: 949
For future reference: Using createFromFormat with the second parameter not being a Carbon object was giving me this same error. Using Carbon::parse::
instead of createFromFormat
seemed to fix the issue:
public function setPublishedAtAttribute($date) {
$this->attributes['published_at'] = Carbon::parse($date);
}
Upvotes: 2