CrazyEngineers
  • Date format conversion in Javascript

    kalaivani M

    Member

    Updated: Oct 26, 2024
    Views: 1.3K
    i have coded to convert the date format dd/mm/yyyy to ddmmyyyy in javascript but its not working . i have attached my snippet here, kindly tell me what mistake i have done here.



    <html>
    <body>
    
    <input type="date" id="id1"/>
    <button onclick="myfunction()">click me</button>
    
    <p id="id2"></p>
    <script>
    function myfunction()
    {
    
    var date=document.getElementById("id1").value;
    date=date.format('DDMMYYYY');
    
    document.getElementById("id2").innerHTML=date;
    }
    
    </script>
    </body>
    </html>
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Home Channels Search Login Register