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

toLocaleDateString ()<br />

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

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

Syntax<br />

Its syntax is as follows:<br />

Date.toLocaleString()<br />

Return Value<br />

Returns the "date" portion using the operating system's locale's conventions.<br />

Example<br />

Try the following example.<br />

<br />

<br />

JavaScript toLocaleDateString Method<br />

<br />

<br />

<br />

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

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

<br />

<br />

<br />

Output<br />

Formated Date : 7/28/1993<br />

toLocaleFormat ()<br />

Javascript date toLocaleFormat() method converts a date to a string using the<br />

specified formatting.<br />

Note: This method may not compatible with all the browsers.<br />

264

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

Saved successfully!

Ooh no, something went wrong!