日期处理时间

在添加日期是 如果不想要时间 就在想要展现的时间后面加

{
                            field: 'SEOTitle',
                            title: 'SEOTitle'

                        },
                        {
                            field: 'SEOKeywords',
                            title: 'SEOKeywords'

                        },
                       
                        {
                            field: 'SEODescription',
                            title: 'SEODescription'

                        },
                        {
                            field: 'FTitle',
                            title: '标题'

                        },
                        {
                            field: 'FTime',
                            title: '发布日期',
                            formatter: function (value, row, index) {
                                return changeDateFormat(value)
                            }
                           
                        },
                        {
                            field: 'FId',
                            title: '操作',

                            formatter: operateFormatter //自定义方法,添加操作按钮
                        },

然后写个Js是方法

//日期格式更改
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;
}

将JS应用带HTML 就行了

 

 这样处理后的日期就不会在出现后面的时间了 ,只会显示日期

 

 

 

posted on 2019-11-06 16:00  透明的鱼!  阅读(102)  评论(0)    收藏  举报

导航