Web | This Site

JavaScript Basics
JavaScript Objects
JavaScript Advanced
JS Useful References
JS Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM

| Home |  | References |  | Discussion Forums |  | About TP

# Javascript Date setTime() Method

## Description:

Javascript date setTime() method sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.

## Syntax:

    Date.setTime(timeValue)

Note: Paramters in the bracket are always optional

Here is the detail of parameters:

- timeValue :An integer representing the number of milliseconds since 1 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>

This will produce following result :

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

To understand it in better way you can Try it yourself.

Advertisement

Online Image Processing

Indian Baby Names