age calculator

<!DOCTYPE html>
<html>
<head>
	<title>Date of Birth Calculator</title>
	<style type="text/css">
		label, input, button {
			display: block;
			margin: 10px;
		}
	</style>
</head>
<body>
	<h1>Date of Birth Calculator</h1>
	<label for="birthdate">Enter your birthdate:</label>
	<input type="date" id="birthdate">
	<button onclick="calculateAge()">Calculate Age</button>
	<p id="result"></p>

	<script type="text/javascript">
		function calculateAge() {
			var birthdate = new Date(document.getElementById("birthdate").value);
			var today = new Date();
			var age = Math.floor((today - birthdate) / (365.25 * 24 * 60 * 60 * 1000));
			document.getElementById("result").innerHTML = "Your age is: " + age;
		}
	</script>
</body>
</html>

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.