Advanced Age Calculator
Job Age Calculator
function advanced_age_calculator_tool() {
ob_start();
$result = "";
if (isset($_POST['calculate_age'])) {
$dob = $_POST['dob'];
if (!empty($dob)) {
$birthDate = new DateTime($dob);
$today = new DateTime();
$diff = $today->diff($birthDate);
$years = $diff->y;
$months = $diff->m;
$days = $diff->d;
// Total days
$totalDays = $today->diff($birthDate)->days;
// Day name
$dayName = $birthDate->format('l');
// Next birthday
$nextBirthday = new DateTime($today->format('Y') . '-' . $birthDate->format('m-d'));
if ($nextBirthday < $today) {
$nextBirthday->modify('+1 year');
}
$daysLeft = $today->diff($nextBirthday)->days;
$result = "
🎂 Age
$years Years, $months Months, $days Days 📅 Total Days
$totalDays 📆 Born On
$dayName 🎉 Next Birthday
In $daysLeft Days
";
}
}
?>
$years Years, $months Months, $days Days 📅 Total Days
$totalDays 📆 Born On
$dayName 🎉 Next Birthday
In $daysLeft Days
Advanced Age Calculator