JavaScript Date toString() Method

Definition and Usage

toString() The method converts a Date object to a string.

Note:JavaScript automatically calls this method whenever it needs to display a Date object as a string.

Example

Convert a Date object to a string:

var d = new Date();
var n = d.toString();

Try it yourself

Syntax

Date.toString()

Parameters

No parameters.

Technical Details

Return Value: A string representing the date and time in string format.
JavaScript Version: ECMAScript 1

Browser Support

Methods Chrome IE Firefox Safari Opera
toString() Support Support Support Support Support

Related Pages

Tutorial:JavaScript Date

Tutorial:JavaScript Date Format

Tutorial:JavaScript String