setTime()

Introduction

The setTime() method Sets a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970. The following is the syntax for the setTime() method.

obj.setTime();

Example

The following is the code for the setTime() method.

var obj = new Date(); document.write(obj.setTime());

On running the above code, the following output is obtained.