0

i am using Jquery Range slider. When user chooses the date its show in a text filed. Below is the code for range slider

$(function() {
    $( "#slider-range" ).slider({
      range: true,
      min: new Date('2020.01.01').getTime() / 1000,
      max: new Date('2020.12.01').getTime() / 1000,
      step: 86400,
      values: [ new Date('2020.03.01').getTime() / 1000, new Date('2020.08.01').getTime() / 1000 ],
      slide: function( event, ui ) {
        $( "#amount" ).val( (new Date(ui.values[ 0 ] *1000).toDateString() )  );
        $( "#amount1" ).val(  (new Date(ui.values[ 1 ] *1000)).toDateString() );
      }
    });
    $( "#amount" ).val( (new Date($( "#slider-range" ).slider( "values", 0 )*1000).toDateString()) );
    $( "#amount1" ).val( (new Date($( "#slider-range" ).slider( "values", 1 )*1000)).toDateString());
  });

I have to exclude day from the chosen date and just show the day, month and year

This is the current format Sun Mar 01 2020 i need to exclude the Sun from this . Please advise

  • var s = 'Sun May 11,2014'; function reformatDate(s) { function z(n){return ('0' + n).slice(-2)} var months = [,'jan','feb','mar','apr','may','jun', 'jul','aug','sep','oct','nov','dec']; var b = s.split(/\W+/); return b[3] + '-' + z(months.indexOf(b[1].substr(0,3).toLowerCase())) + '-' + z(b[2]); } console.log(reformatDate(s)); – Serkan Yıldırım Oct 26 '20 at 07:37

0 Answers0