0

I am using HTML5 element type="date" for the date this display in the browser as DD-MM-YYYY format but I want to change the format to this 'Jul 5, 2018' using jQuery.

How can I do this? Any plugin? Thanks in advance.

<input type="date" class="form-control">
Mohan Rajput
  • 634
  • 9
  • 21
Adam Pavlov
  • 307
  • 4
  • 17

1 Answers1

-1

If you want you need to use date.js to work

var getDate = new Date('2018-01-06');
var dateGet = getDate.toString('dd-MM-yy');

Otherwise you can do this

If you have date format lik 2018-05-26

var dateGet = '2018-05-26'.split('-');
var finalDate = dateGet[1] + '-' + dateGet[2] + '-' + dateGet[0].slice(-2);

Now do the console.log or alert to check console.log(finalDate) or alert(finalDate)

Bhanu Sengar
  • 372
  • 2
  • 10