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 />

Output<br />

743850547000<br />

Date Static Methods<br />

In addition to the many instance methods listed previously, the Date object also<br />

defines two static methods. These methods are invoked through the Date()<br />

constructor itself.<br />

Method<br />

Date.parse( )<br />

Date.UTC( )<br />

Description<br />

Parses a string representation of a date and time and<br />

returns the internal millisecond representation of that<br />

date.<br />

Returns the millisecond representation of the specified<br />

UTC date and time.<br />

In the following sections, we will have a few examples to demonstrate the<br />

usages of Date Static methods.<br />

Date.parse ( )<br />

Javascript date parse() method takes a date string and returns the number of<br />

milliseconds since midnight of January 1, 1970.<br />

Syntax<br />

Its syntax is as follows:<br />

Date.parse(datestring)<br />

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

Parameter Details<br />

datestring: A string representing a date.<br />

Return Value<br />

Number of milliseconds since midnight of January 1, 1970.<br />

Example<br />

272

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

Saved successfully!

Ooh no, something went wrong!