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.

javascript
// 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():

Similar Reads

Method 1: Using JavaScript Date() constructor

Creating date object using date string: The date() constructor creates a date in human-understandable date form....

Method 2: Using JavaScript toDateString() method

This method returns the date portion of the Date object in human-readable form....

Method 3: Using Date.parse() method

The JavaScript Date parse() Method is used to know the exact number of milliseconds that have passed since midnight, January 1, 1970, till the date we provide....

Method 4: Using Intl.DateTimeFormat() and new Date():

Using Intl.DateTimeFormat() and new Date(), the approach formats the input string using specified options for year, month, and day. It then creates a new Date object from the formatted string, effectively converting the string into a date....

Supported Browsers

Google ChromeFirefoxEdgeOperaApple Safari...