Dates not saved as expected

Posted 2 years ago by Khudadad

I'm using a date picker in front end and when submit the form the date changed and another date is stored in the database (i.e 2016-30-05 is changed to 2018-06-05). any help.


    $date = $request->input('buy-date');
           $purchaseDate = Carbon::createFromFormat('d/m/Y',$date );
           $newPurchase->buy_date = $purchaseDate->toDateString();

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.