JavaScript Reference/Javascript Methods/setTime

Материал из Web эксперт
Перейти к: навигация, поиск

"setTime()" Example

   <source lang="javascript">
   

<html> <body> <button onclick="var myDate = new Date(); myDate.setTime(myDate.getTime()); alert(myDate);">SETTIME</button> </body> </html>


     </source>
   
  


"setTime()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |Date | +----------------+--------------------------------------------------------------+

     </source>
   
  


"setTime()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Sets the time by supplying milliseconds elapsed since January 1, 1970.

Syntax:

dateName.setTime(param1) Parameters:

   param1   Required; the number of milliseconds.
   
     
     </source>