How to get current Date and Time using JavaScript

Prem Tiwari - - 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


About: Prem Tiwari

Prem Tiwari is the founder of and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.

Tags: , , , , , ,