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.
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]);