Home > Article > Web Front-end > Introduction to the use of setTime() method in JavaScript_Basic knowledge
The javascript Date.setTime() method sets the time represented by the Date object in milliseconds since January 1, 1970 00:00:00 UTC.
Grammar
Date.setTime(timeValue)
Note: The data inside and outside the brackets are optional
Here are the details of the parameters:
Return value:
Example:
<html> <head> <title>JavaScript setTime Method</title> </head> <body> <script type="text/javascript"> var dt = new Date( "Aug 28, 2008 23:30:00" ); dt.setTime( 5000000 ); document.write( dt ); </script> </body> </html>
This will produce the following results:
Thu Jan 1 06:53:20 UTC+0530 1970