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

Syntax<br />

Its syntax is as follows:<br />

Date.toLocaleFormat()<br />

Parameter Details<br />

formatString: A format string in the same format expected by the strftime()<br />

function in C.<br />

Return Value<br />

Returns the formatted date.<br />

Example<br />

Try the following example.<br />

<br />

<br />

JavaScript toLocaleFormat Method<br />

<br />

<br />

<br />

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

document.write( "Formated Date : " + dt.toLocaleFormat( "%A, %B %e, %Y" ));<br />

<br />

<br />

<br />

Output<br />

Formated Date : Wed Jul 28 1993 14:39:07 GMT+0530 (India Standard Time)<br />

toLocaleString ()<br />

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

operating system's local conventions.<br />

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

265

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

Saved successfully!

Ooh no, something went wrong!