Level 70
you can use Carbon::parse() for date parse those are not the carbon instance.
\Carbon\Carbon::parse($this->start_date)->format('Y-m-d H:i');
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello
I'm using date time input field
<input type="datetime-local">
It returns a formatted date time yyyy-MM-ddThh:mm
Now i want to convert this format to Y-m-d H:i using php-carbon Package.
I have tried
\Carbon\Carbon::createFromFormat(
'yyyy-MM-ddTh:mm', $this->start_date
)->format('Y-m-d H:i:s');
But it failed. Any solutions?
you can use Carbon::parse() for date parse those are not the carbon instance.
\Carbon\Carbon::parse($this->start_date)->format('Y-m-d H:i');
Please or to participate in this conversation.