使用jquery如何获取时间(3)

Date.prototype.MaxDayOfDate = function() { var myDate = this; var ary = myDate.toArray(); var date1 = (new Date(ary[0],ary[1]+1,1)); var date2 = date1.dateAdd(1,'m',1); var result = dateDiff(date1.Format('yyyy-MM-dd'),date2.Format('yyyy-MM-dd')); return result; }

//+---------------------------------------------------
//| 取得当前日期所在周是一年中的第几周
//+---------------------------------------------------

Date.prototype.WeekNumOfYear = function() { var myDate = this; var ary = myDate.toArray(); var year = ary[0]; var month = ary[1]+1; var day = ary[2]; document.write('< script language=VBScript\> \n'); document.write('myDate = DateValue(''+month+'-'+day+'-'+year+'') \n'); document.write('result = DatePart('ww', myDate) \n'); document.write(' \n'); return result; }


//+---------------------------------------------------
//| 字符串转成日期类型
//| 格式 MM/dd/YYYY MM-dd-YYYY YYYY/MM/dd YYYY-MM-dd
//+---------------------------------------------------

function StringToDate(DateStr) { var converted = Date.parse(DateStr); var myDate = new Date(converted); if (isNaN(myDate)) { //var delimCahar = DateStr.indexOf('https://www.jb51.net/')!=-1?'https://www.jb51.net/':'-'; var arys= DateStr.split('-'); myDate = new Date(arys[0],--arys[1],arys[2]); } return myDate; }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzdsxd.html