Hi friends.
you can find your age using the below script.the age was calculated using PHP script.
Let's take a clear look about age calculator.
age_calculator.php
<div class="main">
<form method="post" action="#" name="Agefinder">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>Your Dob : </td>
<td><input type="text" value="" placeholder="23/05/1989" name="dob" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Find Your Age" name="your_age" /></td>
</tr>
</table>
</form>
</div>
Php script for calculate age:
<?php
if(isset($_POST['your_age']))
{
date_default_timezone_set ("Asia/Calcutta");//Your time Zone
$date=date("d M Y");//Date Format
$dob=$_POST['dob'];//Posted dob
$startDate = strtotime($dob);//Conversion time
$endDate= strtotime($date);
$timeDiff = abs($startDate - $endDate);//Difference between start and end date
$numberDays = $timeDiff/86400;
$numberDays = intval($numberDays);
$days="Total days :".$numberDays; //total days
$birthDate =$dob;
$birthDate = explode("/", $birthDate);
$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md")
? ((date("Y") - $birthDate[2]) - 1)
: (date("Y") - $birthDate[2]));
$yourage="Age is:" . $age; //your Age
}
?>
Display Age and Total days:
<?php
if(isset($_POST['your_age']))
{
echo $yourage;
//echo $days;
}
?>
you can find your age using the below script.the age was calculated using PHP script.
Let's take a clear look about age calculator.
age_calculator.php
<div class="main">
<form method="post" action="#" name="Agefinder">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>Your Dob : </td>
<td><input type="text" value="" placeholder="23/05/1989" name="dob" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Find Your Age" name="your_age" /></td>
</tr>
</table>
</form>
</div>
Php script for calculate age:
<?php
if(isset($_POST['your_age']))
{
date_default_timezone_set ("Asia/Calcutta");//Your time Zone
$date=date("d M Y");//Date Format
$dob=$_POST['dob'];//Posted dob
$startDate = strtotime($dob);//Conversion time
$endDate= strtotime($date);
$timeDiff = abs($startDate - $endDate);//Difference between start and end date
$numberDays = $timeDiff/86400;
$numberDays = intval($numberDays);
$days="Total days :".$numberDays; //total days
$birthDate =$dob;
$birthDate = explode("/", $birthDate);
$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md")
? ((date("Y") - $birthDate[2]) - 1)
: (date("Y") - $birthDate[2]));
$yourage="Age is:" . $age; //your Age
}
?>
Display Age and Total days:
<?php
if(isset($_POST['your_age']))
{
echo $yourage;
//echo $days;
}
?>
No comments:
Post a Comment