Date.prototype.format = function(format) { var o = { "M+": this.getMonth() + 1, //month "d+": this.getDate(), //day "h+": this.getHours(), //hour "m+": this.getMinutes(), //minute "s+": this.getSeconds(), //second "q+": Math.floor((this.getMonth() + 3) / 3), //quarter "S": this.getMilliseconds() //millisecond } if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(format)) format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); return format; }
说明:获取到时间var time = new Date().format("yyyy-MM-dd hh:mm:ss");

最新文章

  1. 好用的wget命令从下载添加环境变量到各参数详解
  2. 更新日志 - BugHD 新增邮件告警功能
  3. sharepoint 开发相关工具总结
  4. vscode 编写python如何禁止 flake8 提示 line too long
  5. MST:Conscription(POJ 3723)
  6. UIcollectionView的使用(首页的搭建1)
  7. Spring+SpringMVC+Mybatis+MAVEN+Eclipse+项目完整环境搭建
  8. Jackknife,Bootstraping, bagging, boosting, AdaBoosting, Rand forest 和 gradient boosting的区别
  9. git clone出现SSL错误
  10. 内存管理 (C++)
  11. Java8函数之旅 (五) -- Java8中的排序
  12. oracle01
  13. kali linux 安装wps office
  14. Java中Dom4j解析XML
  15. python - logging模块应用
  16. Masm615+notepad++6.8.8搭建汇编开发环境
  17. Qt 4.8.2.+VS2008静态编译
  18. 配置SpringMvc + maven 数据源!(四)
  19. Scala 方法和函数
  20. vue.js2.0+elementui ——> 后台管理系统

热门文章

  1. cookie理解与实践【实现简单登录以及自动登录功能】
  2. Codeforces_490_E
  3. C和C++中字符串与数的转换
  4. Descriptor - Python 描述符协议
  5. 几个点认识Nginx服务器
  6. TomCat控制台中文乱码及IDEA设置为UTF-8
  7. 【Java并发工具类】Java并发容器
  8. 非对称加密 秘钥登录 https
  9. React之this绑定
  10. dmock 基于Django的轻量级Mock平台