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 :: how create migration in laravel 
Php :: create child theme in wordpress 
Php :: show woocommerce product variation in table php 
Php :: taxonomy_get_parents drupal 8 
Php :: how to remove duplicate values from a multidimensional array in php 
Php :: wordpress image size name 
Php :: php json get value by key 
Php :: basename in php 
Php :: laravel make model with migration 5.8 
Php :: insert multiple rows laravel 
Php :: how to get structure of table in codeigniter 
Php :: ubuntu apache php version 
Php :: excel return integer from date column laravel 
Php :: change the method name in resource in laravel 
Php :: sort array php by key 
Php :: format a date sting php 
Php :: set custome table laravel eloquent 
Php :: wordpress how to match password 
Php :: laravel create controller 
Php :: qr code generator php 
Php :: laravel count distance lat/longtidue 
Php :: limit text length in php 
Php :: random string value laravel 
Php :: how to send mail in laravel 
Php :: php file_put_contents inode problem 
Php :: substract two datetime and get the different hours and minutes php 
Php :: Laravel Adding Cookie Consent 
Php :: laravel outer join 
Php :: do artisan laravel in code 
Php :: laravel fontawesome 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =