更新时间:2023-02-10 15:30:27
你可以先试着分开输入部分
you can try,first, to seperate the parts of the input
...
var input=$(this).val();
var month=input.substr(0,2)-1;
var day=input.substr(3,2);
var year=parseInt("20"+ input.substr(6,2));
然后启动一个新的Date对象:
and then initate a new Date object:
var date= new Date(year,month,day);
或将其写回现场,如下所示:
or write it back to the field, as you did:
$(this).val((date.getMonth()+1)+'/'+date.getDate()+'/'+date.getFullYear());