问题描述
解决方案
解决方案二:
<divstyle="margin:20px0;"></div>定义日期格式:<inputclass="easyui-datetimebox"data-options="formatter:ww4,parser:w4"style="width:200px;">yyyy年mm月dd日hh点</input><scripttype="text/javascript">functionww4(date){vary=date.getFullYear();varm=date.getMonth()+1;vard=date.getDate();varh=date.getHours();returny+'年'+(m<10?('0'+m):m)+'月'+(d<10?('0'+d):d)+'日'+(h<10?('0'+h):h)+'点';}functionw4(s){varreg=/[u4e00-u9fa5]///利用正则表达式分隔varss=(s.split(reg));vary=parseInt(ss[0],10);varm=parseInt(ss[1],10);vard=parseInt(ss[2],10);varh=parseInt(ss[3],10);if(!isNaN(y)&&!isNaN(m)&&!isNaN(d)&&!isNaN(h)){returnnewDate(y,m-1,d,h);}else{returnnewDate();}}</script>
时间: 2024-10-28 18:29:38