Home > Web Front-end > JS Tutorial > body text

Introduction to the use of setTime() method in JavaScript_Basic knowledge

WBOY
Release: 2016-05-16 15:55:36
Original
1382 people have browsed it

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)
Copy after login

Note: The data inside and outside the brackets are optional

Here are the details of the parameters:

  • timeValue: Represents an integer (number of milliseconds) since January 1970 00:00:00 UTC.

Return value:

  • NA

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>

Copy after login

This will produce the following results:

Thu Jan 1 06:53:20 UTC+0530 1970 

Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!