Javascript - Date toLocaleDateString() Method

The toLocaleDateString() method converts the date part of a Date object into a readable string, using locale settings.

Description

The toLocaleDateString() method converts the date part of a Date object into a readable string, using locale settings.

Syntax

Date.toLocaleDateString()

Return

A String, representing the date as a string

Example

Return the Date object as a string, using locale conventions:

Demo

//display the date as a string.
var d = new Date();
var n = d.toLocaleDateString();
console.log(n);//from w ww  .  ja  v  a  2 s  .c  o  m

Result