Level 36
imho you have to change the the time field in your database to fit your format.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a date that's being selected in a datepicker in the following format using AM/PM
Y-m-d g:i A
When I submit the form offcourse Laravel won't update the record because the format is unknown to my DATETIME field in mysql.
public function setDateAttribute($value)
{
$this->attributes['date'] = Carbon::createFromFormat('Y-m-d g:i A', $value)->format('Y-m-d H:i:s');
}
The original value is not being updated. Any idea what I might be doing wrong?
Thank you
Please or to participate in this conversation.