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 :: remove public from laravel 8 url 
Php :: laravel collection higher order messages 
Php :: Separate A String Into Array Elements 
Php :: PHP strnatcmp — String comparisons using a "natural order" algorithm 
Php :: laravel gigapay resend payout notification 
Php :: jobs laravel 
Php :: run url in php 
Php :: To show inline category 
Php :: Add “Affected Products” in catalog price rule 
Php :: laravel gigapay get single employee 
Php :: which song has the most curse words 
Php :: codeigniter input required function in php 
Php :: php strip period 
Php :: How to create an Invoice with watermark FPDF 
Php :: laravel routes options 
Php :: php iterate through objects 
Php :: doctrine remove element from arraycollection 
Php :: laravel get user aget from request 
Php :: php send 204 
Php :: yii2 multilple andFilterWhere 
Php :: laravel 9 remove public from url 
Php :: check session sweet alert 
Php :: simple-phpunit --version handling the phpunit-setup event returned with error code 127 on ubuntu 
Php :: php exponential equation 
Php :: Convert English Date Time To Persian Date Time JDF PHP 
Php :: relationship on the base of condition in laravel 
Php :: php 8 constructor property promotion 
Php :: Replace default WP search and dropdown placeholder 
Php :: simple using mdb with php script PDO 
Php :: Jaygaah Free Shipping Woocommerce 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =