Your Blog Post
<!DOCTYPE html>
<html lang="en">
<head>
<title>Your Page Title</title>
<style>
/* body {
font-family: 'Arial', sans-serif;
align-items: center;
margin: 0;
background-color: #f0f0f0;
}
#calculator {
text-align: center;
background-color: #ffffff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
padding: 20px;
max-width: 400px;
width: 100%;
}
h1 {
color: #333333;
}
label {
display: block;
margin: 10px 0;
color: #555555;
}
input {
width: 100%;
padding: 8px;
box-sizing: border-box;
margin-bottom: 10px;
border: 1px solid #cccccc;
border-radius: 4px;
}
button {
background-color: #4caf50;
color: #ffffff;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
#result {
font-weight: bold;
margin-top: 20px;
text-align: left;
color: #333333;
}
p {
margin: 8px 0;
} */
/* Hide the link */
a[href="https://www.tectuner.com/"] {
display: none;
}
</style>
</head>
<body>
<div id="calculator">
<h1>Age Calculator</h1>
<label for="dob">Date of Birth:</label>
<input type="date" id="dob">
<button onclick="calculateAge()">Calculate</button>
<div id="result">
<p id="currentAge"></p>
<p id="ageYears"></p>
<p id="ageMonths"></p>
<p id="ageWeeks"></p>
<p id="ageDays"></p>
<p id="ageHours"></p>
<p id="ageMinutes"></p>
<p id="ageSeconds"></p>
</div>
</div>
<script>
function calculateAge() {
const dobInput = document.getElementById('dob');
const dob = new Date(dobInput.value);
const currentDate = new Date();
const ageInMilliseconds = currentDate - dob;
const ageInSeconds = ageInMilliseconds / 1000;
const ageInMinutes = ageInSeconds / 60;
const ageInHours = ageInMinutes / 60;
const ageInDays = ageInHours / 24;
const ageInWeeks = ageInDays / 7;
const ageInMonths = ageInDays / 30.44; // average days in a month
const ageInYears = ageInMonths / 12;
document.getElementById('currentAge').innerText = `Your age is ${Math.floor(ageInYears)} years, ${Math.floor(ageInMonths)} months, and ${Math.floor(ageInDays)} days.`;
document.getElementById('ageYears').innerText = `Your age is ${Math.floor(ageInYears)} years.`;
document.getElementById('ageMonths').innerText = `Your age is ${Math.floor(ageInMonths)} months.`;
document.getElementById('ageWeeks').innerText = `Your age is ${Math.floor(ageInWeeks)} weeks.`;
document.getElementById('ageDays').innerText = `Your age is ${Math.floor(ageInDays)} days.`;
document.getElementById('ageHours').innerText = `Your age is ${Math.floor(ageInHours)} hours.`;
document.getElementById('ageMinutes').innerText = `Your age is ${Math.floor(ageInMinutes)} minutes.`;
document.getElementById('ageSeconds').innerText = `Your age is ${Math.floor(ageInSeconds)} seconds.`;
}
</script>
</body>
</html>