10.02.2018 Views

js_tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Javascript<br />

setTime ()<br />

Javascript date setTime() method sets the Date object to the time represented<br />

by a number of milliseconds since January 1, 1970, 00:00:00 UTC.<br />

Syntax<br />

Its syntax is as follows:<br />

Date.setTime(timeValue)<br />

Note: Parameters in the bracket are always optional.<br />

Parameter Detail<br />

timeValue :An integer representing the number of milliseconds since 1 January<br />

1970, 00:00:00 UTC.<br />

Example<br />

Try the following example.<br />

<br />

<br />

JavaScript setTime Method<br />

<br />

<br />

<br />

var dt = new Date( "Aug 28, 2008 23:30:00" );<br />

dt.setTime( 5000000 );<br />

document.write( dt );<br />

<br />

<br />

<br />

Output<br />

Thu Jan 01 1970 06:53:20 GMT+0530 (India Standard Time)<br />

setUTCDate ()<br />

Javascript date setUTCDate() method sets the day of the month for a specified<br />

date according to universal time.<br />

252

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!