$(function(){ var currTime=new Date(); var strDate=currTime.getFullYear()+"-"+(currTime.getMonth()+1)+"-01"; $('#globalStopDate').datebox({formatter:function(date){ var y = date.getFullYear(); var m = date.getMonth() + 1; m = m < 10 ? '0' + m : m; return y.toString() + '-' + m.toString(); },parser:function(date){ console.log(date); if (date) { return new Date(String(date).substring(0, 4) + '-' + String(date).substring(5,7)); } else { return new Date(); } }}); $('#globalStopDate').datebox('setValue',strDate);//默认加载当前月份 });