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.
you can use Carbon::parse
for date parse.
\Carbon\Carbon::parse($this->start_date)->format('Y-m-d H:i');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With