get selected value in datePicker and format it

前端 未结 4 1843
花落未央
花落未央 2021-02-10 02:01

In the datePicker selected 20.04.2012. I want to get this value, format it and store in a variable. I uses this code:

var date = $(\"#scheduleDate\"         


        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-10 02:17

    $('#scheduleDate').datepicker({ dateFormat : 'dd, MM, yy'});
    
    var dateFormat = $('#scheduleDate').datepicker('option', 'dd, MM, yy');
    
    $('#scheduleDate').datepicker('option', 'dateFormat', 'dd, MM, yy');
    
    var result = $('#scheduleDate').val();
    
    alert('result: ' + result);
    

    result: 20, April, 2012

提交回复
热议问题