JavaScript Date toDateString() method

The JavaScript date toDateString() method returns the date portion of a Date object in the form of string.

Syntax

The toDateString() method is represented by the following syntax:

Return

A string representing the date portion of a Date object.

JavaScript Date toDateString() method example

Here, we will understand toDateString() method through various examples.

Example 1

Let's see an example to fetch current date in the form of string.

Test it Now

Output:

Tue Aug 07 2018 

Example 2

Let's see an example to fetch date portion only from the specified Date object.

Test it Now

Output:

Fri Aug 15 1947

Example 3

Let's see one more example to fetch date portion only from the specified Date object.

Test it Now

Output:

Fri Aug 15 1947
Next TopicJavaScript Date




Latest Courses