For Advertisements on this blog Contact Us at developgram@gmail.com or +91-9923438816

Simple Programming Tutorials For Beginners

Wednesday, April 19, 2017

Date (DD/MM/YYYY HH:MM:SS)

<html>
<body>
  <script>
    var dt = new Date();
    var day = dt.getDate();
    var month = dt.getMonth() + 1; //January is 0
    var year = dt.getFullYear();
    var hour = dt.getHours();
    var minute = dt.getMinutes();
    var second = dt.getSeconds();

    if (month < 10)
      month = "0" + month;

    var new_date = day + "/" + month + "/" + year + " " + hour + ":" + minute + ":" + second;

    document.write(new_date);
  </script>
</body>
</html>


No comments:

Post a Comment

SEARCH THIS BLOG