JavaScript > Date

Date & Time in JavaScript

How to get current date and time in the JavaScript?

To get the current date and time in the JavaScript, follow this approach.

        var d = new Date();

In the above code snippet, we have instantiated the Date object (in built in JavaScript) and saved into the d variable. Then using the alert method to show the value of d.


 Views: 5020 | Post Order: 98

Write for us

Hosting Recommendations