function (data) {
var date = new Date(data)
var Y = date.getFullYear() + '-'
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())
return Y + M + D + h + m + s
}

参数data即为从后台或者其他地方传入的时间戳,最后转换的日期格式为:

如果需要其他格式,可以自行变化,如有疑问,可留言!

最新文章

  1. C#设计模式(2)——简单工厂模式
  2. Caf.CMS是一个免费的、 开源,功能齐全的CMS
  3. nodejs review-04
  4. SqlServer 递归查询树形数据
  5. 给input的按钮控件添加onserverclick事件
  6. Web服务器与Servlet容器
  7. kmeans理解
  8. ndk-gdb of NDK r9d modified to *always* debug the &quot;:remote&quot;-process of your app
  9. JavaScript- The Good Parts function Curry
  10. bzoj3685普通van Emde Boas树 线段树
  11. MySQL常用命令(数据库,表相关的命令)
  12. python socket 实现的简单http服务器
  13. 洛谷P3354 Riv河流 [IOI2005] 树型dp
  14. Atitit 获取剪贴板内容
  15. javascript控制滚动条的位置,获取控件的位置
  16. hallo world
  17. Android filesystem system rw(read/write) permission
  18. jQuery的过滤器总结
  19. 在Ubuntu里启用root账号
  20. P1725 琪露诺

热门文章

  1. CSS之Flex 布局
  2. 基于jQuery日历插件制作日历
  3. MyEclipse打包带源码的jar包
  4. 命令行下运行 java someClass.class出现 “错误:找不到或无法加载主类someClass ” 的解决方案
  5. Latex表格太宽处理方法 (How to shorten Latex table length)
  6. Mac 下VIM配置
  7. 初识WCF1
  8. 安装系统+数据库+Sharepoint全套教程 (摘抄自https://www.cnblogs.com/jianyus/p/5482075.html)
  9. Java并发基础(上)——Thread
  10. December 30th 2016 Week 53rd Friday