js获得当前系统时间
来源:互联网 发布:鬼怪故事 知乎 编辑:程序博客网 时间:2024/04/29 09:48
Date.prototype.Format = function (fmt) { //author: meizz var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 "h+": this.getHours(), //小时 "m+": this.getMinutes(), //分 "s+": this.getSeconds(), //秒 "q+": Math.floor((this.getMonth() + 3) / 3), //季度 "S": this.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt;}
调用: var time1 = new Date().Format("yyyy-MM-dd");var time2 = new Date().Format("yyyy-MM-dd HH:mm:ss");
var date = new Date();console.log(date.getHours()+":"+date.getMinutes()+":"+date.getSeconds() )11:25:8
转自 :http://www.cnblogs.com/zhangpengshou/archive/2012/07/19/2599053.html
资料 :http://www.w3school.com.cn/js/js_obj_date.asp
0 0
- js 获得系统当前时间
- js获得当前系统时间
- js获得当前时间
- 获得当前系统时间
- 获得系统当前时间
- 获得系统当前时间
- 获得当前系统时间
- 获得系统当前时间
- 获得系统当前时间
- 获得当前系统时间
- 获得系统当前时间
- js获得当前系统时间(html标签自定义属性)
- js获得当前日期时间
- js中获得当前时间
- js中获得当前时间
- 获得当前系统时间(JAVA)
- java获得系统当前时间
- java获得系统当前时间
- Cube Stacking 1988 (并查集 好题)
- 【LeetCode】(54)Spiral Matrix(Medium)
- artTemplate使用总结
- java中的泛型总结
- 将DataTable转换成EasyUITree的json格式 ---四级树
- js获得当前系统时间
- [LeedCode OJ]#8 String to Integer (atoi)
- Java关键字之this
- 安卓源码总体结构(1)基础知识汇总
- Android笔记——导入Github开源项目CircleRefreshLayout
- JavaScript实现新闻上下滚动
- oracle数据库
- TNS-12535: TNS:operation timed out
- IOS UI 之 去tabelView分割线