toString (Date - JavaScript)

Gets a string representation of the Date object.

Defined in

Date (Standard - JavaScript)

Syntax

toString() : string
Return value Description
string The string representation of the Date object.

Examples

(1) This computed label displays the current date and time.
var date = new Date();
date.toString()
// 11/26/08 11:25

(2) This computed label displays the base date and time (where the time zone is -5).

var date = new Date(0);
date.toString()
// 01/01/70 01:00