时间戳转为日期格式

easyui datagrid 日期时间显示不正常,后台java 类型为时间戳 经过JSON工具一转化传到前台来就是这样,不便 于是想格式化一下,

$(
'#gridTable' ).datagrid({
          title: '系统通知及广告管理' ,
          loadMsg: '数据加载中,请稍后……' ,
          rownumbers: true ,
          pagination: true ,
          singleSelect: false ,
          pageSize: 10,
          pageList: [5, 10, 15, 20],
          fitColumns: true ,
    fit: true ,
          striped: true ,
          nowrap: false ,
          url: 'list.do' ,
          idField: 'mediaId' ,
    columns:[[
     {field: 'id' ,checkbox: true },
     {field: 'system' ,title: '适用系统' },
     {field: 'infoType' ,title: '消息类型' ,
      formatter:
              function (value, row, index){
              if (value==1)
               return "文本" ;
              if (value==2)
               return "图片" ;
              if (value==3)
               return "视频" ;
              else
               return "<span style=\"color:red\" >未知</span>" ;
       }},
            {field: 'title' ,title: '标题' },
            {field: 'content' ,title: '内容' ,width:140},
        {field: 'issueTime' ,title: '生效时间' ,
             formatter: function (value,row,index){
              var unixTimestamp = new Date(value);
              return unixTimestamp.toLocaleString();
              }
      },
        {field: 'disabledTime' ,title: '失效时间' },
        {field: 'userId' ,title: '用户ID' },
        {field: 'userName' ,title: '操作员' }
    ]],
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值