How to get current Date and Time using JavaScript

In this tutorial i will let you know the very esay and simple way to get current Date and Time using JavaScript code. I will explain with demo examples because i know examples are 1000 time better than text explanations. It is often easier to understand the code.

You can get the current date and time using var today = new Date(); function, It will return the standard date time format like below if you are from india:


JavaScript get current date


Use below code to get current date from JavaScript Date() object in Y-m-d format.

Another date and time from Date() object in Y-m-d H:i:s format.

JavaScript ISO (Date-Time) format


If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Article Tags: , , , , , ,