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 :: php add to array 
Php :: popular cms 
Php :: laravel validation check value should be one of in array 
Php :: php shortcode wordpress return content with shortcodes 
Php :: call api php 
Php :: laravel collection partition 
Php :: toastr in php 
Php :: pdo error message 
Php :: merge array in php 
Php :: alias to change php version on ubuntu 
Php :: select2 on modal 
Php :: acf wordpress loop through and display blog posts order by date and type 
Php :: enable extensions in php.ini 
Php :: php insert to mysql 
Php :: how to create foreign key in laravel 
Php :: getimagesize php 
Php :: The specified module could not be found php 
Php :: twig resto 
Php :: php library to convert html to amp 
Php :: foreach sort orderby php 
Php :: remove last 3 character from string php 
Php :: how to go one folder back in __dir__ in php 
Php :: empty in php 
Php :: api resource create in laravel 
Php :: spatie activity log 
Php :: laravel simple pagination 
Php :: laravel composer sanctum 
Php :: laravel db query log string replacements 
Php :: wp_schedule_event 
Php :: php rce command 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =