toString Method (Date)

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



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();

// 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.

© 2016 Microsoft