Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript toLocaleString() Method

JavaScript toLocaleString() Method

Date Object Reference JavaScript Date object

Example

Converts a Date object to a string based on local time:

var d=new Date();

var n=d.toLocaleString();

n Output result:

Try it »


Definition and Usage

The toLocaleString() method converts a Date object to a string based on local time and returns the result.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the toLocaleString() method


Syntax

Date

.toLocaleString()

Return Value

Type Description
String Date and time are output as a string.

Technical Details

JavaScript version: 1.0

Date Object Reference JavaScript Date object