Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.

navigator.globalization.getDateNames(successCallback, errorCallback, options);


Returns the array of names to the successCallback with a properties object as a parameter. That object contains a value property with an Array of String values. The array features names starting from either the first month in the year or the first day of the week, depending on the option selected.

If there is an error obtaining the names, then the errorCallback executes with a [GlobalizationError](GlobalizationError/globalizationerror.html) object as a parameter. The error's expected code is [GlobalizationError](GlobalizationError/globalizationerror.html).UNKNOWN\_ERROR.

The options parameter is optional, and its default values are:

{type:'wide', item:'months'}

The value of options.type can be narrow or wide.

The value of options.item can be months or days.

Supported Platforms

  • Android
  • BlackBerry WebWorks (OS 5.0 and higher)
  • iOS
  • Windows Phone 8

Quick Example

When the browser is set to the en\_US locale, this example displays a series of twelve popup dialogs, one per month, with text similar to month: January:

    function (names) {
        for (var i = 0; i < names.value.length; i++) {
            alert('month: ' + names.value[i] + '\n');
    function () { alert('Error getting names\n'); },
    { type: 'wide', item: 'months' }

Full Example

    <title>getDateNames Example</title>
    <script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
    <script type="text/javascript" charset="utf-8">

    function checkDateNames() {
        function (names) {
          for (var i=0; i<names.value.length; i++) {
            alert('month: ' + names.value[i] + '\n');
        function () {alert('Error getting names\n');},
        {type:'wide', item:'months'}

    <button onclick="checkDateNames()">Click for date names</button>