Description
The setTime() method sets a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970.
This method has the form:
Date.setTime(millisec)
Parameter | Description |
---|---|
millisec | (required) The number of milliseconds to be added to, or subtracted from, midnight January 1, 1970 |
Examples
The following example shows the basic use of this method.
<script>
var d = new Date();
d.setTime(1286162868965);
document.write(d);
</script>
This produces the following result:
Browser Support
Firefox | IE | Chrome | Opera | Safari |
---|---|---|---|---|