I have small laravel project working on date conversion. I have date string that getting from request on format dd/mm/yyyy. Code and result show as below.
$request->stockupdate ;
// dd/mm/yyyy (02/05/2019)
Then I try to convert to yyyy-mm-dd using carbon.
$_stockupdate= Carbon::parse($request->stockupdate)->format('Y-m-d');
I got parse result as below.
2019/02/05 // Seem it is 2 Feb 2019 not 5 May 2019.
That's wrong, It should be 2019/05/02 instead. Any advise or guidance would be greatly appreciated, Thanks.