在datagrid中转换日期

xiaoxiao2025-07-29  25

EasyUi datagrid中传换日期 效果:

{ field : 'createdate', title : '创建日期', width : '20%', //传换日期 formatter:function(value,row,index){ return formatterDate(value); } }, //进行日期转换 function formatterDate(date) { //得到日期并转换 var oDate = new Date(date), oYear = oDate.getFullYear(), oMonth = oDate .getMonth() + 1, oDay = oDate.getDate(), oHour = oDate.getHours(), oMin = oDate .getMinutes(), oSen = oDate.getSeconds(), oTime = oYear + '-' + getzf(oMonth) + '-' + getzf(oDay) + ' ' + getzf(oHour) + ':' + getzf(oMin) + ':' + getzf(oSen);// 最后拼接时间 return oTime; }; //补0操作 function getzf(num) { if (parseInt(num) < 10) { num = '0' + num; } return num; }
转载请注明原文地址: https://www.6miu.com/read-5033946.html

最新回复(0)