Get Date Using JavaScript

We can get Date using JavaScript built in object Date. In below example we will see how to get date using JavaScript Date object.

example to get current date using JavaScript in dd-mm-yyyy format:-

the above code will print the date in dd/mm/yyyy format. If you want to print the date in different format like mm/dd/yyyy format or mm-dd-yyyy or in any different combination, then we can easily modify above code.

Date object in JavaScript can only be instantiated by calling the constructor of Date object. Date object provides many overloaded Date constructors as shown below

get date using JavaScript

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.