Search
 
SCRIPT & CODE EXAMPLE
 

PHP

calculate person age by birthdate php

 public function getAge($date)
    {
        
        $dob = new DateTime($date);
        
        $now = new DateTime();
         
        $difference = $now->diff($dob);
         
        $age = $difference->y;
         
        return  $age;
    }
Comment

Calculate Age or Date of Birth in PHP

$dateOfBirth = "15-06-1995";
$today = date("Y-m-d");
$diff = date_diff(date_create($dateOfBirth), date_create($today));
echo 'Your age is '. $diff->format('%y');
Comment

calculate age from date of birth in php

$dateOfBirth = "17-10-1985";
$today = date("Y-m-d");
$diff = date_diff(date_create($dateOfBirth), date_create($today));
echo 'Age is '.$diff->format('%y');
Comment

PREVIOUS NEXT
Code Example
Php :: url encode php 
Php :: php curl post json 
Php :: laravel Route::group definition 
Php :: install php-8 extentions 
Php :: php string to array 
Php :: check if a string contains a substring php 
Php :: php unit skip test 
Php :: what is app_env in laravel 
Php :: wpml get current language filter 
Php :: laravel https assets 
Php :: error log array 
Php :: button back php 
Php :: php curl delete request 
Php :: Disable wordpress wp cron 
Php :: hide wordpress errors 
Php :: session has laravel blade 
Php :: php compare string 
Php :: get client size in laravel 
Php :: php get hostname 
Php :: php model last record 
Php :: show php erros 
Php :: display errors in codeigniter 
Php :: laravel 8 bootstrap pagination fix 
Php :: 419 unknown status 
Php :: default php timezone to newyork 
Php :: delete cache laravel 
Php :: Fatal error: Maximum execution time of 120 seconds exceeded in 
Php :: get domain from subdomain php 
Php :: get category name by id wordpress 
Php :: php move file 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =