Laravel Carbon not converting the desired format

From datepicker, I have received a date e.g.

Sat Sep 15 2018 09:29:18 GMT+0530 (IST)

I did the following but it show me the below error message:

$date = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $receivedDateFromdatePicker);
echo $date;

Unexpected data found. Unexpected data found. The separation symbol could not be found Trailing data

Upvotes: 0

Views: 134

Answers (1)

Fatemeh Majd
Fatemeh Majd

Reputation: 739

just use the simple way:

$date = new \Carbon\Carbon($receivedDateFromdatePicker);

Upvotes: 0

Related Questions