jeudi 19 décembre 2019

Carbon date format properly not formatting in Laravel?

my parsing date format is in date/month/year (21/02/2010) i am using carbon to change the format to year-month-date (2010-02-21) but it by default its taking the date as month so it's not converting properly and of course when the date is more than 12 its through an error . Here is the code.

$date = $request->date;
$newdate = Carbon::parse($date)->format('Y-m-d');
return $newdate;


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire