Nuju
Nuju

Reputation: 332

How to set the datetimepicker month name format as three digit eg. Jan

I am using bootstrap datetimepicker. I want the datetimepicker format as short month name eg. Jan. My code is below and it shows the full month name now as January. How to make it Jan?

$('.datepickersren').datetimepicker({             
    format: 'MMMM',
    viewMode: "months", 
})

Please note that the format:'M' is not working in datetimepicker. It will work on the datepicker only. If we give format:'M' in datetimepicker, the month format is month number eg. 5, 6, 7 etc. Not the month names like Jan, Feb, etc.

Upvotes: 3

Views: 4903

Answers (2)

Ali Niaz
Ali Niaz

Reputation: 312

A single M is "Month name short"

      $('.datepickersren').datetimepicker({             
          format: 'dd-M-yy',
          viewMode: "months", 
      })

Upvotes: 1

Nuju
Nuju

Reputation: 332

$('.datepickersren').datetimepicker({             
    format: 'MMM',
    viewMode: "months", 
})

The above code is working for me and the format: 'MMM' displays the three letter month name as Jan, Feb etc. Thank you all for the response.

Upvotes: 2

Related Questions