Welcome To Freeware Tips Forum Index
Join! (free) SearchFAQMemberlistUsergroupsLog in

Age Updating Script

 
Reply to topic    Welcome To Freeware Tips Forum Index » Coding Tips -> PHP View previous topic
View next topic
Age Updating Script
Author Message
Please Register and Login to this forum to stop seeing this advertsing.




Josh
Co Admin

Joined: 16 Jul 2008
Posts: 110
Add Comment
Show Comments
Add Karma



Post Age Updating Script Reply with quote
Code:
<?php
 // Calculate the age from a given birth date
function GetAge($Birthdate)
 {
    // Explode the date into meaningful variables
    
    list($BirthYear,$BirthMonth,$BirthDay) = explode("-", $Birthdate);
    
    // Find the differences
    
    $YearDiff = date("Y") - $BirthYear;
    
    $MonthDiff = date("m") - $BirthMonth;
    
    $DayDiff = date("d") - $BirthDay;
    
    // If the birthday has not occured this year
    
    if ($DayDiff < 0 || $MonthDiff < 0)
    
    $YearDiff--;
    
    return $YearDiff;

      }
echo "" . GetAge("YEAR-MONTH-DAY"). " .";
  ?>

If you was born in 1983 or something like that it would be then the February would be 02  then day 22

1989-02-22

Hope you like this  viking
Tue Apr 28, 2009 9:09 am View user's profile Send private message Visit poster's website
Speed
Site Admin

Joined: 16 Jul 2008
Posts: 1247
Add Comment
Show Comments
Add Karma



Post Reply with quote
Nice man




_________________


Train Insane or Remain The Same
There's No Room In A Warriors Heart For Self Doubt
Tue Apr 28, 2009 5:38 pm View user's profile Send private message Visit poster's website
Display posts from previous:    
Reply to topic    Welcome To Freeware Tips Forum Index » Coding Tips -> PHP All times are GMT
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Card File  Gallery  Forum Archive
Powered by phpBB © 2001, 2005 phpBB Group
Design by Speed