Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

Laravel Calculate Age from Date of Birth

$dateOfBirth = '1994-07-02';

$years = Carbon::parse($dateOfBirth)->age;

  

dd($years);
Comment

laravel get age from date

$birth_date = '1994-07-02';
$age = CarbonCarbon::now()->diffInYears($birth_date);
dd($age.' Years');
Comment

PREVIOUS NEXT
Code Example
Php :: switching inter php 
Php :: how to use old for select in blade laravel 
Php :: php get string after character 
Php :: laravel show routes artisan 
Php :: laravel running a specific migration on different path 
Php :: try and catch laravel 
Php :: get random posts wordpress 
Php :: {{Str::limit laravel 
Php :: Your requirements could not be resolved to an installable set of packages. 
Php :: macos install php 7.4 
Php :: inrandomorder laravel 
Php :: woocommerce get my account url 
Php :: php replace space with 20 
Php :: php delete all files in folder 
Php :: php generate random alphanumeric string 
Php :: php get current datetime mysql format 
Php :: disable wordpress admin bar 
Php :: laravel custom model primary Key 
Php :: enie letter validation laravel regex 
Php :: get first key of array php 
Php :: php string to array 
Php :: what is app_env in laravel 
Php :: beaver builder shortcode post title 
Php :: php regex remove file extension 
Php :: end session variable php 
Php :: laravel insert or ignore 
Php :: home url wordpress 
Php :: Laravel loop with counter 
Php :: php find differences between two arrays 
Php :: symfony clear cache 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =