ES6 - toLocaleDateString() Method



Javascript date toLocaleDateString() method converts a date to a string, returning the "date" portion using the operating system's locale's conventions.

Syntax

Date.toLocaleString()       

Return Value

Returns the "date" portion using the operating system's locale's conventions.

Example

var dt = new Date(1993, 6, 28, 14, 39, 7); 
console.log( "Formated Date : " + dt.toLocaleDateString())         

Output

Formated Date : 7/28/1993          
Advertisements