
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How to format JavaScript date into yyyy-mm-dd format?
To format a JavaScript date into “yyyy-mm-dd” format, use the toISOString() method. It converts using ISO standard i.e.
YYYY-MM-DDTHH:mm:ss.sss
Example
You can try to run the following code to format a date.
<html> <head> <title>JavaScript Dates</title> </head> <body> <script> var date, res; date = new Date(); res = date.toISOString(); document.write(res); </script> </body> </html>
Output
2018-12-15T08:13:47.648Z
- Related Articles
- Java Program to format date in mm-dd-yyyy hh:mm:ss format
- MySQL query to convert YYYY-MM-DD to DD Month, YYYY date format
- MySQL date format DD/MM/YYYY select query?
- Convert MySQL date format from yyyy-mm-ddThh:mm:ss.sssZ to yyyy-mm-dd hh:mm:ss ?
- How to parse Date from String in the format: dd/MM/yyyy to dd/MM/yyyy in java?
- MySQL date format to convert dd.mm.yy to YYYY-MM-DD?
- Get date format DD/MM/YYYY with MySQL Select Query?
- Accepting date strings (MM-dd-yyyy format) using Java regex?
- Program to reformat date in YYYY-MM-DD format using Python
- How to format a string to date in as dd-MM-yyyy using java?
- How to insert mm/dd/yyyy format dates in MySQL?
- Get today's date in (YYYY-MM-DD) format in MySQL?
- Change date format (in DB or output) to dd/mm/yyyy in PHP MySQL?
- Display Date in E MMM dd yyyy format in Java
- Display Date Time in dd MMM yyyy hh:mm:ss zzz format in Java

Advertisements