Platinum Partner

DateTime: Simple Date Operations In Javascript


/*
### begin_: file metadata
    ### 
    ### main:
    ###   - name : cfDateTime.js
    ###     desc : |
    ###         Simple date operations in jscript.
    ###         This file is for use with windows scripting host.
    ###     date : created="Thu 2005-12-01 11:57:38"
    ###     last : lastmod="Thu 2005-12-01 12:18:57"
    ###     lang : jscript
    ###     tags : jscript javascript date time now month hour year cfDateTime
    ### 
    */

/// begin_: declare and init variables
    var today       = new Date();
    var strYear     = today.getFullYear();
    var iMonth      = today.getMonth() + 1; // +1, we do NOT want zero-based month index
    var iQuarter    = Math.ceil((iMonth / 12) * 4);
    var iDay        = today.getDate();
    var strDateOut  = "";

/// begin_: leading zeropad single-digit numbers
    iMonth = (iMonth < 10)? "0" + iMonth : iMonth;
    iDay = (iDay < 10)? "0" + iDay : iDay;

/// begin_: display output
    strDateOut = strYear+"-"+ iMonth +"-"+iDay + " ";
    WScript.Echo (strDateOut);

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}