js 时间 字符串
来源:互联网 发布:手机淘宝没有店铺收藏 编辑:程序博客网 时间:2024/06/08 05:18
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 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 time=updateTime;//为js获取的时间字符串
var time2 =new Date(time).format('yyyy-MM-dd hh:mm:ss');
0 0
- js字符串格式化时间
- js 时间 字符串
- js字符串转时间
- JS 字符串转化时间类型
- js中格式化时间字符串
- js 字符串转化为时间
- js中格式化时间字符串
- js 时间戳转字符串
- JS 时间字符串转换成时间
- js:将时间obj转为json字符串
- JS 两个字符串时间的天数差
- js格式化日期字符串进行时间比较
- JS日期字符串转时间戳
- js字符串和时间戳互相转换
- js转换时间戳与日期字符串
- js 日期转字符串 时间类型转换
- JS获取时间生成随机字符串
- JS字符串时间比较+计算时间差
- System.out.println(new String(buf,0,num));
- 第十五周项目3 B-树的基本操作
- (第十六周项目1)验证算法
- 第十五周 项目1 排序(堆排序)
- 第14周项目2二叉排序树中查找的路径
- js 时间 字符串
- WordCount程序详解
- 第十三周 项目3 二叉排序树
- 第十五周 项目二 用哈希法组织关键字
- 第十六周 项目一 (1) 插入排序之直接插入排序
- 第十六周实践项目1—验证算法(3)直接选择排序
- libsvm处理多分类的问题
- 第16周项目1-验证算法(1)直接插入排序
- 第十六周 项目一 验证算法(2) 希尔排序