toString()  Date  instance method JS Home  <<  JS Reference  <<  Date  <<  toString()

Description

Returns a locale specific string representation of the specifed date.

This method overrides the toString() method of Object.

Syntax

Signature Description
aDate.toString()Returns a locale specific string representation of the specifed date.

Parameters

None.

Examples

The code below shows an example of the toString() method of Date.



// Create a Date instance for the current date and time.
var todaysDate = new Date();

alert(todaysDate.toString());

Press the button below to action the above code:

Related Tutorials

JavaScript Intermediate Tutorials - Lesson 2 - Dates and Times