JavaScript Date Formats

JavaScript Date Formats


JavaScript Date Formats
There are various types date formats in JavaScript and some date formats are as follows:
  1. ISO Date – e.g., "2022-04-20" (The International Standard)
  2. Short Date - e.g., "04/20/2022"
  3. Long Date - e.g., "Apr 20 2022" or "20 Apr 2022"
1. JavaScript  ISO(International Standard Organization)
The ISO 8601 aims to provide a well-defined method of representing calendar date and times in worldwide communications and the syntax (YYYY-MM-DD) of this standard is the preferred date format in JavaScript.
Example
Output
2. JavaScript Short Date
Short dates are written with an "MM/DD/YYYY" syntax like this:
Example
Output
3. JavaScript Long Date
The "MMM DD YYYY" is the format used to write Long dates. The month and date can be written in any order, and it is allowed to write a month in abbreviated (Apr) form or in full (April).
Example
Output