JavaScript Date Formats JAVASCRIPT

JavaScript Date Formats  

JavaScript Date Formats

JavaScript Date Input

There are generally 3 types of JavaScript date input formats:

Type Example
ISO Date "2020-01-25" (The International Standard)
Short Date "01/25/2020"
Long Date "Jan 25 2020" or "25 Jan 2020"

The ISO format follows a strict standard in JavaScript.

The other formats are not so well defined and might be browser-specific.

JavaScript Date Output

Independent of input format, JavaScript will (by default) output dates in full-text string format:

Wed Jan 25 2020 05:30:00 GMT+0530 (India Standard Time)

JavaScript ISO Dates

ISO 8601 is the international standard for the representation of dates and times.

The ISO 8601 syntax (YYYY-MM-DD) is also the preferred JavaScript date format:

Example (Complete date)


var d = new Date("2020-01-25");

JavaScript Long Dates.

Long dates are most often written with a "MMM DD YYYY" syntax like this:


var d = new Date("Jan 25 2020");

JavaScript Short Dates

Short dates are written with an "MM/DD/YYYY" syntax like this:


var d = new Date("01/25/2020");

ISO Dates (Date-Time)

ISO dates can be written with added hours, minutes, and seconds (YYYY-MM-DDTHH:MM:SSZ):


var d = new Date("2015-03-25T12:00:00Z");

The date and time are separated with a capital T.

UTC time is defined with a capital letter Z.

If you want to modify the time relative to UTC, remove the Z and add +HH:MM or -HH:MM instead:

var d = new Date("2015-03-25T12:00:00-06:30");

Download free E-book of JAVASCRIPT

Learn Programming for Free

Join Programmers Community on Telegram

Talk with Experienced Programmers

Just drop a message, we will solve your queries