Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

FareedR's avatar

How to change date format in dd/mm/yyyy for database

currently working on date in react js . how convert it into other format . attachment below is equivalent with this https://imgur.com/a/1iv0eOg

$dateParse = Carbon::parse($request->get('estimate_shipping'));
$dateParse = Carbon::parse($request->get('estimate_shipping'))->format('d/m/Y'); // Gives me error ( call member function on string()
dd($request->get('estimate_shipping'),$dateParse);


0 likes
2 replies
JohnBraun's avatar

To solve the error you mention in the code block, you should first create a Carbon object from the 'estimate_shipping' request parameter. You can even define how the 'estimate_shipping' parameter is formatted when it comes in, using the createFromFromat() method.

Carbon::parse(request('estimate_shipping'))->format('d/m/Y');
// or
Carbon::createFromFormat('m-d-Y', request('estimate_shipping'))->format('d/m/Y');

Please or to participate in this conversation.