/* ### begin_: file metadata ### <region-file_info> ### 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 ### </region-file_info> */ /// 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);
You need to create an account or log in to post comments to this site.