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


Prem Tiwari

Prem Tiwari is the founder of and also a professional developer and a blogger by hobby.

Tags: , , , , , ,

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.