Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

get age with carbon in laravel

use CarbonCarbon; // 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");
 
PREVIOUS NEXT
Tagged: #age #carbon #laravel
ADD COMMENT
Topic
Name
9+4 =