日期年月日时分秒万能格式转化
2017-08-25 16:48
204 查看
日期年月日时分秒万能格式转化
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 filename = new Date().Format("yyyy-MM-dd") $(".dateStartInfo ").text(filename)
相关文章推荐
- c#.net 获取时间日期年月日时分秒格式
- Oracle 查询日期显示年月日时分秒格式
- to_char()函数返回日期格式为年月日时分秒格式
- c#.net 获取时间日期年月日时分秒格式
- 后台传来毫秒格式日期换成年月日时分秒显示在前台
- ASP.NET C# 日期时间年月日时分秒格式及转换
- oracle --sql--转换表字段日期格式(年月日时分秒转换年月日)
- DateTime格式转化为年月日时分秒毫秒字符串
- c#.net 获取时间日期年月日时分秒生成自动文件名格式
- Java日期转换 SimpleDateFormat格式(年月日时分秒)
- 由秒数转化为时分秒格式
- 日期格式的转化
- Jox(解决了日期格式转化和导出XML中文乱码问题)
- C# 日期格式转化
- 日期格式转化
- SQL中日期格式转换为年月日
- asp.net 将20070520的日期格式转化成2007-05-20
- 将日期字符串格式化为年月日格式如2011-12-14 、16日、18日-19日、21日、23日、25日-26日、28日
- SQLServer提取日期中的年月日及其他格式
- 将日期按照一定的格式转化