Vinoth
Vinoth

Reputation: 1103

how to get the month name instead of month no. in month picker using bootstrap

hi i am using monthpicker using bootstrap.

http://jsfiddle.net/k5zookLt/602/

<div class="form-group">
<label>Second check out:</label>
<input type="text" style="width:25%" class="form-control form-control-2 input-sm to" placeholder="Calender">
</div>

it gives me the output with the month number like 02/2017, but i need the month name like (February/2017) instead of month number. Please Help.

Upvotes: 0

Views: 1593

Answers (2)

Nana Partykar
Nana Partykar

Reputation: 10548

Change

$('.to').datepicker({
    autoclose: true,
    minViewMode: 1,
    format: 'mm/yyyy'
}).on('changeDate', function(selected){

To

$('.to').datepicker({
    autoclose: true,
    minViewMode: 1,
    format: 'MM/yyyy' //Change Here
}).on('changeDate', function(selected){

Considering February Month as an example

  1. format: 'MM/yyyy': February/2017
  2. format: 'M/yyyy': Feb/2017
  3. format: 'mm/yyyy': 02/2017
  4. format: 'm/yyyy': 2/2017

Upvotes: 1

derrysan7
derrysan7

Reputation: 457

Change your date format to: format: 'MM/yyyy'

notes: use uppercase M instead of lowercase m

Upvotes: 3

Related Questions