Date.prototype.Format = function(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;
} new Date().Format('YYYY-MM-dd HH:mm:ss');

  

javascript data format的更多相关文章

  1. javascript版format函数,方便实现复杂字串连接

    javascript版format函数,方便实现复杂字串连接 String.prototype.format = function () { var args = arguments; console ...

  2. JavaScript data types and data structures

    JavaScript data types and data structures Programming languages all have built-in data structures, b ...

  3. loadrunner执行场景时报Error -27040: Data Format Extension: Init: Internal error问题解决

    [问题描述] 在loadrunner控制台执行场景时,所有用户均Failed,查看errors,错误原因如下: Error -27040: Data Format Extension: Init: I ...

  4. [转]javascript Date format(js日期格式化)

    方法一:这个很不错,好像是 csdn 的 Meizz 写的: // 对Date的扩展,将 Date 转化为指定格式的String // 月(M).日(d).小时(h).分(m).秒(s).季度(q)  ...

  5. [荐]javascript Date format(js日期格式化)

    cnblog:http://www.cnblogs.com/zhangpengshou/archive/2012/07/19/2599053.html 方法一: // 对Date的扩展,将 Date  ...

  6. JavaScript string.format

    //string.format String.prototype.format=function(){ var e = this, f = arguments.length; if (f > 0 ...

  7. javascript Date format(js日期格式化) 转载

    本文转载地址http://www.cnblogs.com/zhangpengshou/archive/2012/07/19/2599053.html // 对Date的扩展,将 Date 转化为指定格 ...

  8. coding++ :javascript Date format (js日期格式化)

    方式一: // 对Date的扩展,将 Date 转化为指定格式的String // 月(M).日(d).小时(h).分(m).秒(s).季度(q) 可以用 1-2 个占位符, // 年(y)可以用 1 ...

  9. javascript Date format(js日期格式化) (转)

    方法一:这个很不错,好像是 csdn 的 Meizz 写的: // 对Date的扩展,将 Date 转化为指定格式的String // 月(M).日(d).小时(h).分(m).秒(s).季度(q) ...

随机推荐

  1. go递归函数如何传递数组切片slice

    数组切片slice这个东西看起来很美好,真正用起来会发现有诸多的不爽. 第一,数组.数组切片混淆不清,使用方式完全一样,有时候一些特性又完全不一样,搞不清原理很容易误使用. 第二,数组切片的appen ...

  2. tensor flow 视频

    http://v.youku.com/v_show/id_XMTYxMjQ2NTYyNA==.html?spm=a2h1n.8251843.playList.5!19~5~A.siMjNW&f ...

  3. groovy 环境配置

    win7: 下载 http://www.groovy-lang.org/download.html 将解压后的文件夹里的bin目录加入path环境变量

  4. java写简单Excel 首行是目录 然后前台下载

    页面: <form action="${path}/xxx/xxx.do" method="get" > 表格下载:<input type=& ...

  5. memcache缓存失效

    缓存过期 memcached在处理过期的缓存项时,采用懒惰模式处理方法. 缓存项过期,不会立即删除,直到对该缓存项执行了get操作,才会删除过期缓存. > set key 0 10 > t ...

  6. sqlserver查询区分大小写

    例子: select * from tb_students where name='jay' select * from tb_students where name='JAY' 这两句查询结果是一样 ...

  7. jquery:为动态加载的元素添加点击事件

    jquery:为动态加载的元素添加点击事件 最近在做项目的时候遇到了这样一个问题,给用ajax动态加载出来的内容添加点击事件,但是怎么都触发不了,经过查询试验总结出正确的写法 在jquery1.7之前 ...

  8. vue小常识小注意

    1,跨域携带cookie,加一个拦截器,能后加上request.credentials=true就可以了 Vue.http.interceptors.push(function(request, ne ...

  9. TPM、read counts、RPKM/FPKM你选对了吗?

    TPM.read counts.RPKM/FPKM你选对了吗? 已有 3940 次阅读 2017-12-15 15:04 |个人分类:RNA-seq|系统分类:科普集锦|关键词:RNA-seq| RN ...

  10. Codeforces 670D1. Magic Powder - 1 暴力

    D1. Magic Powder - 1 time limit per test: 1 second memory limit per test: 256 megabytes input: stand ...