JavaScript Date to a string using toString() Method

The JavaScript toString() method is used to convert the Date object to a string. It method returns the current day name, month name, date, year, and time.

Note: The toString() method is automatically called by JavaScript whenever a Date object needs to be displayed as a string.

Syntax

Return value

It returns the converted string (representing the given date).

Convert JavaScript Date to string Example | toString() Method

The Example of toString() method converts a Date object to a string in JS.

Output:

JavaScript Date to string Example toString Method

How to JavaScript date to string format?

Answer: You can do it:-

Read more:- JavaScript date format example | code

Do comment if you have any suggestions, doubts or questions on this tutorial.

Note: The All JS Examples codes are tested on the Safari browser (Version 12.0.2) and Chrome.
OS: macOS 10.14 Mojave
Code: HTML 5 Version


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.