Skip to content
Related Articles

Related Articles

JavaScript Date toLocaleDateString() Method
  • Last Updated : 03 Jul, 2020

Below is the example of Date toLocaleDateString() method.

  • Example:

        var dateObj = new Date(); 
        var options = { weekday: "long", 
                        year: "numeric", 
                        month: "short", 
                        day: "numeric" }; 
        .toLocaleDateString("en-US", options));


  • Output:
    Sunday, Jun 24, 2018

The date.toLocaleDateString() method is used to convert a date to a string.

dateObj.toLocaleDateString( [locales][, options])

Parameters: This method accepts two parameters as mentioned above and described below:

  • locales: This parameter is an array of locale strings that contain one or more language or locale tags.Note that it is an optional parameter.If you want to use specific format of the language in your application then specify that language in the locales argument.
  • Options: It is also an optional parameter and contains properties that specify comparison options.Some properties are localeMatcher, timeZone, weekday, year, month, day, hour, minute, second etc.

Return values: It returns a date as a string value in specific format that is specified by locale.

Note: The dateObj should be a valid Date object.

More codes for the above method are as follows:
Program 1: Without parameters return value of this method cannot be relied upon in scripting.It uses the operating system’s locale’s conventions.

   var dateObj = new Date(1993, 6, 28, 14, 39, 7);



Note: The locales and options arguments are not supported in all browsers.To check whether it is supported or not we can use following function :

function toLocaleDateStringSupportsLocales()
    try {
        new Date().toLocaleDateString('i');
    catch (e) {
        return === 'RangeError';
    return false;

Supported Browsers: The browsers supported by JavaScript Date toLocaleDateString() Method are listed below:

  • Google Chrome
  • Internet Explorer
  • Mozilla Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up
Recommended Articles
Page :