How to use toDateString() method In Javascript
This method returns the date portion of the Date object in human-readable form.
Example: This example shows the above-explained approach.
// Date object
let date = new Date(2019, 5, 3);
//Display output
console.log(date.toDateString());
Output
Mon Jun 03 2019
Convert string into date using JavaScript
In this article, we will convert a string into a date using JavaScript. A string must follow the pattern so that it can be converted into a date.
A string can be converted into a date in JavaScript through the following ways:
Table of Content
- Using JavaScript Date() constructor
- Using JavaScript toDateString() method
- Using Date.parse() method
- Using Intl.DateTimeFormat() and new Date():