I am using a bootstarp datepicker :DatepickerLink
but I need to change the format on the basis of a variable ,how to do that?
I am trying to use this code
if (sessionStorage.Dateformat && sessionStorage.Dateformat != '') {
dateFormat = sessionStorage.Dateformat;
}
else{
dateFormat='dd-M-yyyy';
}
////////////////////////////////////////////////////////
$('#sand .input-group.date').datepicker({
format: dateFormat,
todayHighlight: true
});
but it is saying invalid date format ///////For Information This way is working
$('#sand .input-group.date').datepicker({
format: 'dd-M-yyyy',
todayHighlight: true
});