Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to calculate age 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"); // To check result
 
PREVIOUS NEXT
Tagged: #calculate #age #laravel
ADD COMMENT
Topic
Name
3+2 =