Answers for "get age with carbon in laravel"

PHP
1

get age with carbon in laravel

use Carbon\Carbon; // Include Class in COntroller

$request->date_of_birth = "2000-10-25";
$age = Carbon::parse($request->date_of_birth)->diff(Carbon::now())->y;

dd($age. " Years");
Posted by: Guest on August-07-2021

Browse Popular Code Answers by Language