ES6 - toString() Method



This method returns a string representing the specified Date object.

Syntax

Date.toString () 

Return Value

Returns a string representing the specified Date object.

Example

var dateobject = new Date(1993, 6, 28, 14, 39, 7); 
stringobj = dateobject.toString(); 
console.log( "String Object : " + stringobj );         

Output

String Object : Wed Jul 28 1993 14:39:07 GMT+0000 (UTC)          
Advertisements