`
annan211
  • 浏览: 461249 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

js time format Object [object Date] has no method 'Format'

 
阅读更多


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;
};
分享到:
评论

相关推荐

    servlet2.4doc

    The default behavior of this method is to call addDateHeader(String name, long date) on the wrapped response object. addDateHeader(String, long) - Method in interface javax.servlet....

    DevExpress VCL v2012 vol 1.6源码、例子、帮助

    Q434045 - cxMemo - Scrollbars are not shown if the editor is the last object in a DFM file, the editor has no text, and its Properties.ScrollBars property is set to ssBoth at design time B218869 - ...

    DevExpress VCL v2012 vol 1.6源码、例子、帮助-Part1

    Q434045 - cxMemo - Scrollbars are not shown if the editor is the last object in a DFM file, the editor has no text, and its Properties.ScrollBars property is set to ssBoth at design time B218869 - ...

    DevExpress VCL 2012 vol 1.6源码、例子、帮助-Part2

    Q434045 - cxMemo - Scrollbars are not shown if the editor is the last object in a DFM file, the editor has no text, and its Properties.ScrollBars property is set to ssBoth at design time B218869 - ...

    DevExpress VCL v2012 vol 1.6源码、例子、帮助-part2

    Q434045 - cxMemo - Scrollbars are not shown if the editor is the last object in a DFM file, the editor has no text, and its Properties.ScrollBars property is set to ssBoth at design time B218869 - ...

    DevExpress VCL 2012 vol 1.6源码、例子、帮助-Part1

    Q434045 - cxMemo - Scrollbars are not shown if the editor is the last object in a DFM file, the editor has no text, and its Properties.ScrollBars property is set to ssBoth at design time B218869 - ...

    DevExpress VCL v2012 vol 1.6源码-例子-帮助-part2

    Q434045 - cxMemo - Scrollbars are not shown if the editor is the last object in a DFM file, the editor has no text, and its Properties.ScrollBars property is set to ssBoth at design time B218869 - ...

    DevExpress VCL v2012 vol 1.6源码-例子-帮助-part1

    Q434045 - cxMemo - Scrollbars are not shown if the editor is the last object in a DFM file, the editor has no text, and its Properties.ScrollBars property is set to ssBoth at design time B218869 - ...

    C# 5.0 Programmer’s Reference

    Appendix P: Date and Time Format Specifiers Appendix Q: Other Format Specifiers Appendix R: Streams Appendix S: Filesystem Classes Appendix T: Regular Expressions Appendix U: Parallel Programming ...

    webservice-ajax

    side JavaScript calls. One more thing has to be done here: we need the Web Method that we will call from client-side JavaScript. Let us define it like this: [WebMethod] public string ...

    精美的js日期控件,可以多个参数设定。

    0 (zero) the calendar has no future or past restrictions (default). Note if you would like the calendar to be directional starting from today–as opposed to (1) tomorrow or (-1) yesterday–use a ...

    DbfDotNet_version_1.0_Source

    Most importantly for me, implementing the .DBF rather that my own custom format has no impact on runtime speed. How does it compare to ADO.Net, SQL, SqlLite, SharpSQL ... I did some speed test ...

    计算机网络第六版答案

    Because the router has the entire packet at time t1, it can begin to transmit the packet to the receiving host at time t1. At time t2 = t1 + L/R2, the router completes transmission and the entire ...

    Sakemail

    does not format the message in multipart mode if people send an attach, without writing any text and with no MIME settings. Fixed. This could be serious, I recommend upgrading.1.8.8- A small fix with ...

    freemarker总结

    ${x_index + 1}.${x}<#if x_has_next>, 星期四"><#break></#if> <p>We have these animals: <tr><th>Name<th>Price <tr><td>${being.name}${being.price} Euros </table> 输出为: ...

    EurekaLog_7.5.0.0_Enterprise

    1)....Fixed: Added workaround for codegen bug in Delphi 7 (possibly - other), bug manifests itself as wrong date-time in reports or integer overflows 2)....Fixed: Some MAPI DLLs may not be loaded ...

    Universal-USB-Installer

    Source Code is made available at time of download, from the official UUI page: http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/ IMPORTANT! No Warranty is being offered with this ...

    javascript-cheat-sheet-v1

    ### JavaScript Cheat Sheet v1 本篇文章旨在通过一份详尽的JavaScript速查表,为初学者提供一份简洁且全面的学习资源。这份速查表涵盖了JavaScript中常见的对象、属性、方法等核心概念,并通过示例帮助读者更好地...

    Bochs - The cross platform IA-32 (x86) emulator

    attributes, 1.44 MB floppy support, set file modification date/time - converted the complete hdimage stuff to the new 'hdimage' plugin - new hdimage method get_capabilities() that can return ...

    微软内部资料-SQL性能优化5

     If the table is a heap (in other words, it has no clustered index), the bookmark is a RID, which is an actual row locator in the form File#:Page#:Slot#. Finding Rows with a NC Index on a Heap ...

Global site tag (gtag.js) - Google Analytics