Home > Article > Web Front-end > Tutorial on using the Date.toSource() method in JavaScript_Basic knowledge
This method returns a string representing the source code of the object.
Note: This method may not work properly on all browsers like IE.
Grammar
Date.toSource()
Here are the details of the parameters:
Return value:
Example:
<html> <head> <title>JavaScript toSource Method</title> </head> <body> <script type="text/javascript"> var dt = new Date(1993, 6, 28, 14, 39, 7); document.write( "Formated Date : " + dt.toSource() ); </script> </body> </html>
This will produce the following results:
Formated Date : (new Date(743850547000))