Created
June 28, 2021 03:11
-
-
Save kenmasters/d58c1900e247309a93c571806dc1b279 to your computer and use it in GitHub Desktop.
LARAVEL CARBON DATE FROM FORMAT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CODE INPUT: | |
Route::get('sample', function(){ | |
$date = '06-28-2021'; //@fromFormat" m-d-Y | |
$date2 = Carbon::createFromFormat('m-d-Y', $date)->format('Y-m-d'); //@toFormat" Y-m-d | |
return response()->json(['from:' => $date, 'to' => $date2]); | |
}); | |
RESULT: | |
{ | |
"from:": "06-28-2021", | |
"to": "2021-06-28" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment