databox 当前日期:
class="easyui-datebox"
1 var curr_time = new Date(); 2 var strDate = curr_time.getFullYear() + "-"; 3 strDate += curr_time.getMonth() + 1 + "-"; 4 strDate += curr_time.getDate() + "-"; 5 strDate += curr_time.getHours() + ":"; 6 strDate += curr_time.getMinutes() + ":"; 7 strDate += curr_time.getSeconds(); 8 $("#openTime").datetimebox("setValue", strDate);
datatimebox 当前日期(包含时分秒):
class="easyui-datetimebox"
formatterDate = function (date) { var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate(); var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1); var hor = date.getHours(); var min = date.getMinutes(); var sec = date.getSeconds(); return date.getFullYear() + '-' + month + '-' + day+" "+hor+":"+min+":"+sec; }; $("#closeTime").datetimebox("setValue",formatterDate(new Date()));