在程序中,从数据库中读取到的日期时间类型数据一般是这种格式:"/Date(1355109408000+0800)/"

要经过js函数处理变为格式:'2012-12-10 11:05:21'

用此js函数即可搞定:

function timeFormatter(value) {

    var da = new Date(parseInt(value.replace("/Date(", "").replace(")/" , "").split( "+")[0]));

    return da.getFullYear() + "-" + (da.getMonth() + 1) + "-" + da.getDate() + " " + da.getHours() + ":" + da.getMinutes() + ":" + da.getSeconds();

}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2021-11-08
  • 2022-12-23
  • 2021-09-21
猜你喜欢
  • 2021-11-01
  • 2021-12-11
  • 2022-12-23
  • 2021-11-12
  • 2021-12-18
  • 2019-09-30
相关资源
相似解决方案