Level 51
Try this
public function setpurchasingDateAttribute($value)
{
$this->attributes['purchasing_date'] = Carbon::createFromFormat('D M Y H:i:s eO',$value);
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a date like this Wed Jun 29 2016 00:00:00 GMT+0200 And I am using a mutator like the following
public function setpurchasingDateAttribute($value)
{
$this->attributes['purchasing_date'] = Carbon::createFromFormat('Y-m-d H:i:s',$value);
}
I get this errorUnexpected data found.
Meaning that may be I am formatting badly.
Can anyone help me out?
Please or to participate in this conversation.