Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

toString Method (Date)

Returns a string representation of a date. The format of the string depends on the locale. For U.S. English (en-us), it is as follows:

day of the week month day hour: minute:second time zone year

date.toString()

date

Required. The date to represent as a string.

Returns the string representation of the date.

The following example illustrates the use of the toString method with a date.

var myDate = new Date();
myDate.setFullYear(2100, 5, 5);
var dateString = myDate.toString();
document.write(dateString);

// Output: <date>

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Show:
© 2015 Microsoft