10.02.2018 Views

js_tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Javascript<br />

by the getTime method is the number of milliseconds since 1 January 1970<br />

00:00:00.<br />

You can use this method to help assign a date and time to another Date object.<br />

Syntax<br />

Its syntax is as follows:<br />

Date.getTime ()<br />

Return Value<br />

Returns the numeric value corresponding to the time for the specified date<br />

according to universal time.<br />

Example<br />

Try the following example.<br />

<br />

<br />

JavaScript getTime Method<br />

<br />

<br />

<br />

var dt = new Date( "December 25, 1995 23:15:20" );<br />

document.write("getTime() : " + dt.getTime() );<br />

<br />

<br />

<br />

Output<br />

getTime() : 819913520000<br />

getTimezoneOffset ()<br />

Javascript date getTimezoneOffset() method returns the time-zone offset in<br />

minutes for the current locale. The time-zone offset is the minutes in difference,<br />

the Greenwich Mean Time (GMT) is relative to your local time.<br />

For example, if your time zone is GMT+10, -600 will be returned. Daylight<br />

savings time prevents this value from being a constant.<br />

235

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

Saved successfully!

Ooh no, something went wrong!