为 $("#ReceivedDate").datepicker(); 添加 time:

 

解决办法:

 

 自定义一个函数:

  

function formatDateWithHHmm(current) {
    if (/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(current)) {
        var date = new Date();
        var hh = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
        var mm = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
        return current + ' ' + hh + ':' + mm;
    }
    return current;
}

 

 $("#ReceivedDate").datepicker();  //format: M/d/yyyy

 

$('#ReceivedDate').change(function () {
    $('#ReceivedDate').val(formatDateWithHHmm($('#ReceivedDate').val()));  //最终取值:M/d/yyyy HH:mm
});

 

相关文章:

  • 2022-12-23
  • 2022-01-22
  • 2021-10-12
  • 2021-11-27
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2022-03-05
  • 2022-12-23
  • 2021-06-11
  • 2021-05-21
相关资源
相似解决方案