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.
'Y-m-dTH:i', $this->start_date)
? – FlamenThe separation symbol could not be found Unexpected data found.
– Sadye$this->start_date
var to the question? – Flamen$this->start_date
it came fromFormRequest
class in laravel. This solution worked well\Carbon\Carbon::parse($this->start_date)->format('Y-m-d H:i');
Thanks for helping :) @Flamen – Sadye