将json时间类型格式化
来源:互联网 发布:zphotoengine 源码 编辑:程序博客网 时间:2024/05/17 09:24
// 对Date的扩展,将 Date 转化为指定格式的String// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)// 例子:// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18Date.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;}
阅读全文
0 0
- 将json时间类型格式化
- 将date类型的数据在json输出时格式化
- 时间类型转json后格式化显示方法
- 将Json日期格式化
- 将Json日期格式化
- json时间格式化
- Json 时间格式化
- js格式化json时间
- json时间格式化(JS)
- Java JSON时间格式化
- easyui将时间格式化
- Jquery 时间类型格式化
- mysql时间类型格式化
- 如何格式化JSON时间对象
- Android json格式时间格式化
- 格式化json传送的时间
- asp.net将时间格式化
- strftime() 函数将时间格式化
- 搭建Cocos2d-JS开发环境
- 原生 JavaScript 和 jQuery 的优劣比较
- 引用类型的交换
- 深入浅出Mybatis系列(八)---mapper映射文件配置之select、resultMap
- 剑指offer:第28题字符串全排列
- 将json时间类型格式化
- 如何在Windows下统计代码行数
- 镜像特效和球面化特效知多少?
- ViewPager导航页面,开源框架ultraviewpager的使用
- VS Code
- 链表类CList成员的使用
- php面试题,各大企业常见的php面试题之二
- 为什么数组大了codeblocks就无法工作了?
- 临界区