Age calculator html code -Html code with java script for age calculator

We will try to give you a new code for every day . 
You can create your tool website and earn unlimited with google and google adsense. 
You can create your free website with the google product name as Blogger. 
You just open 
create your account and write or paste this code in the html view of your blogger. 

so the Code is given below you can copy and paste in your website . 

Here is a code for age calculator online   


<div style="text-align: center;">

    <h2><br /></h2><h2><br /></h2><h2><br /></h2><h2>Age Calculator</h2>


        <label>Date of Birth:</label>

        <input id="dob" required="" type="date" />



        <button onclick="calculateAge()">Calculate Age</button>

    </div><div><div><br /></div><div><br /></div></div>

    <div id="result" style="font-weight: bold; margin-top: 20px;"></div>



    function calculateAge() {

        var dob = new Date(document.getElementById('dob').value);

        var today = new Date();

        var ageInMilliseconds = today - dob;

        var ageInSeconds = ageInMilliseconds / 1000;

        var ageInMinutes = ageInSeconds / 60;

        var ageInHours = ageInMinutes / 60;

        var ageInDays = ageInHours / 24;

        var ageInMonths = Math.floor(ageInDays / 30.44); // Average number of days in a month

        var ageInYears = Math.floor(ageInMonths / 12);

        var resultElement = document.getElementById('result');

        resultElement.innerHTML = "Age: " +

            ageInYears + " years, " +

            ageInMonths % 12 + " months, and " +

            Math.floor(ageInDays % 30.44) + " days.";




Popular posts from this blog

बस माल पैक करो और कंपनी को वापस कर दो और 60 हजार रुपए महीना कमाओ, bindi packing business

घर बैठे करे पैकिंग का काम कमाए लाखो रूपये महीना , पॉपकॉर्न कंपनी दे रही है मौका

3 ONLINE EARNING APP , NO CONDITION , NO INVESTMENT , ONLY EARNING , घर बैठे पैसा कमाने के लिए 3 सबसे बढ़िया APP .