前台页面事件处理格式为
<%=Convert.ToDateTime( xinwen.Rows[i]["FTime"]).ToShortDateString() %> 意思是去掉时分秒 只显示年月日
后台时间处理格式为
//日期格式更改
function changeDateFormat(cellval) {
var time = new Date(cellval);
var year = time.getFullYear(); //获取年
var month = time.getMonth() + 1; //获取月
var day = time.getDate(); //获取日
time = year + "-" + month + "-" + day;
return time;
}
写到后台显示区的格式为:
{
field: ‘FTime‘,
title: ‘发布日期‘,
formatter: function (value, row, index) {
return changeDateFormat(value)
}
},
意思是去掉时分秒 只显示年月日
原文:https://www.cnblogs.com/yutang-wangweisong/p/12090604.html