How to use Date in JavaScript

In this article I am going to explain about JavaScript Date object.
  • 2009

Java Script Date object

JavaScript Date object referee to complete Date object reference of the Date. In Date object all properties and method can be use with Date and Time. Date object contain complete information about Date and Time.  Date object are created with Date() constructor.

There are four way by which can identified Date and Time

  • New Date() - Current Date and time.
  • New Date(milliseconds) - Display Date and time in millisecond.
  • New Date(dateString) - Display Date and time in String  format.
  • New Date(year, month, day, hours, minutes, seconds, milliseconds) - Display Date time with brief description.


In following Example we will Display Current Date and Time



    <script type="text/javascript">

        function test() {

            var myDate = new Date();






    <button onclick="test()">






Further Readings
You may also want to read these related articles: here
Ask Your Question 
Got a programming related question? You may want to post your question here


More Articles

© 2020 DotNetHeaven. All rights reserved.