10.07.2017 Views

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

Syntax<br />

Its syntax is as follows:<br />

Date.toLocaleString ()<br />

Return Value<br />

Returns the formatted date in a string fromat.<br />

Example<br />

Try the following example.<br />

<br />

<br />

JavaScript toLocaleString Method<br />

<br />

<br />

<br />

var dt = new Date(1993, 6, 28, 14, 39, 7);<br />

document.write( "Formated Date : " + dt.toLocaleString() );<br />

<br />

<br />

<br />

Output<br />

Formated Date : 7/28/1993, 2:39:07 PM<br />

toLocaleTimeSring ()<br />

Javascript date toLocaleTimeString() method converts a date to a string,<br />

returning the "date" portion using the current locale's conventions.<br />

The toLocaleTimeString method relies on the underlying operating system in<br />

formatting dates. It converts the date to a string using the formatting<br />

convention of the operating system where the script is running. For example, in<br />

the United States, the month appears before the date (04/15/98), whereas in<br />

Germany, the date appears before the month (15.04.98).<br />

Syntax<br />

Its syntax is as follows:<br />

266

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

Saved successfully!

Ooh no, something went wrong!