Home > Blockchain >  How to get day from date bootstrap date picker in jquery?
How to get day from date bootstrap date picker in jquery?

Time:10-15

I have a bootstrap date picker and I have selected the date from input fields but I need to retrieve the day from the date please help me how can I get the day? thanks.

enter image description here

jquery script

 $('.datepicker').on('change', function (date) {
      var checkInnDate = $("#check_inn").val();
      console.log(checkInnDate);
     
  });

CodePudding user response:

You could use the split() method divides a String into char array.

const str = '2021-10-15';

const words = str.split('-');
console.log(words[2]);
  • Related