js日期格式化-由毫秒数得到年月日
来源:互联网 发布:积分兑换java源代码 编辑:程序博客网 时间:2024/06/03 22:47
/**
js由毫秒数得到年月日
使用: (new Date(data[i].creationTime)).Format("yyyy-MM-dd hh:mm:ss.S")
*/
Date.prototype.Format = function (fmt) { //author: tony
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;
};
js由毫秒数得到年月日
使用: (new Date(data[i].creationTime)).Format("yyyy-MM-dd hh:mm:ss.S")
*/
Date.prototype.Format = function (fmt) { //author: tony
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;
};
0 0
- js日期格式化-由毫秒数得到年月日
- 日期格式化分别得到年月日
- Js时间戳毫秒数转日期格式化
- js格式化毫秒到日期
- javaScript中格式化日期毫秒数
- js中对Date日期进行格式化和把日期转换为毫秒数
- 年月日时分秒毫秒格式化
- 根据函数System.currentTimeMillis()返回的毫秒数得到日期
- js由日期得到星期几
- JS日期格式字符串转换为日期毫秒数和时间毫秒数转换为日期
- 用js将从后台得到的时间戳(毫秒数)转换为想要的日期格式
- Javascript格式化毫秒数
- 毫秒数->格式化时间
- 毫秒数和日期
- 毫秒数转日期
- 日期转毫秒数
- js日期格式化,easy-ui,datebox得到日期改变格式
- excel中毫秒数转化为年月日
- GBDT好的学习资料
- SOJ 1024
- 坐标移动
- Activity的四种启动模式
- 1.最长平台问题
- js日期格式化-由毫秒数得到年月日
- CCF会议列表——网络与信息安全
- 题目1015:还是A+B
- noi.openjudge 1909 直方图
- java 通过继承 Thread 类实现多线程
- 9个基于Java的搜索引擎框架
- 设计模式分类(创建型模式、结构型模式、行为型模式)
- 基于VC 6.0 用C语言实现的俄罗斯方块
- 按照OpenShift教程,执行的记录-保存一份(安装一个oc命令,结尾有下载地址)