真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

json.date.js時間相關(guān)-創(chuàng)新互聯(lián)

為山海關(guān)等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及山海關(guān)網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為網(wǎng)站制作、網(wǎng)站建設(shè)、山海關(guān)網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!>function ConvertJSONDateToJSDateObject(jsondate) { var date = new Date(parseInt(jsondate.replace("/Date(", "").replace(")/", ""), 10)); return date; } var _toIsoDate = Date.prototype.toISOString; //借用kendo.toString做出Unspecified Kind的ISO8601格式//Date.prototype.toISOString = function () {// return kendo.toString(this, "yyyy-MM-ddTHH:mm:ss");//};var newdate = null; function getToDay() { var now = new Date(); var nowYear = now.getFullYear(); var nowMonth = now.getMonth(); var nowDate = now.getDate(); newdate= new Date(nowYear, nowMonth, nowDate); nowMonth= doHandleMonth(nowMonth + 1); nowDate= doHandleMonth(nowDate); return nowYear + "-" + nowMonth + "-" + nowDate; } function doHandleMonth(month) { if (month.toString().length == 1) { month= "0" + month; } return month; } function getYesterDay() { var newtimems = newdate.getTime() - (24 * 60 * 60 * 1000); var yesd = new Date(newtimems); var yesYear = yesd.getFullYear(); var yesMonth = yesd.getMonth(); var yesDate = yesd.getDate(); yesMonth= doHandleMonth(yesMonth + 1); yesDate= doHandleMonth(yesDate); return yesYear + "-" + yesMonth + "-" + yesDate; } function getDate(jsondate) { var date = ConvertJSONDateToJSDateObject(jsondate); var year = date.getFullYear(); var month = date.getMonth() + 1; month= month < 10 ? "0" + month : month; var day = date.getDate(); day= day < 10 ? "0" + day : day; return year + "-" + month + "-" + day; } function getDateTime(jsondate) { var date = ConvertJSONDateToJSDateObject(jsondate); var year = date.getFullYear(); var month = date.getMonth() + 1; //month = month < 10 ? "0" + month : month; var day = date.getDate(); //day = day < 10 ? "0" + day : day; var hh = date.getHours(); //hh = hh < 10 ? "0" + hh : hh; var mm = date.getMinutes(); mm= mm < 10 ? "0" + mm : mm; var ss = date.getSeconds(); ss= ss < 10 ? "0" + ss : ss; return year + "/" + month + "/" + day + " " + hh + ":" + mm + ":" + ss; } function getFormatDateTime(jsondate, strformatdatetime) { var date = ConvertJSONDateToJSDateObject(jsondate); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hh = date.getHours(); var mm = date.getMinutes(); mm= mm < 10 ? "0" + mm : mm; var ss = date.getSeconds(); ss= ss < 10 ? "0" + ss : ss; var newdatetime = strformatdatetime.replace("{yyyy}", year); newdatetime= newdatetime.replace("{m}", month); newdatetime= newdatetime.replace("squ6kqw", day); newdatetime= newdatetime.replace("{hh}", hh); newdatetime= newdatetime.replace("{mm}", mm); newdatetime= newdatetime.replace("{ss}", ss); return newdatetime; } function getShortTime(jsondate) { var date = ConvertJSONDateToJSDateObject(jsondate); var hh = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(); var mm = date.getMinutes() == 0 ? "00" : date.getMinutes(); return hh + ":" + mm ; } function getShortHour(jsondate) { var date = ConvertJSONDateToJSDateObject(jsondate); var hh = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(); //var mm = date.getMinutes() == 0 ? "00" : date.getMinutes(); return hh + ":00"; } //聚合算法function dateDiff(date1, date2) { var type1 = typeof date1, type2 = typeof date2; if (type1 == 'string') date1= stringToTime(date1); else if (date1.getTime) date1= date1.getTime(); if (type2 == 'string') date2= stringToTime(date2); else if (date2.getTime) date2= date2.getTime(); return (date1 - date2) / (1000 * 60 * 60 * 24); //結(jié)果是小時} //字符串轉(zhuǎn)成Time(dateDiff)所需方法function stringToTime(string) { var f = string.split(' ', 2); var d = (f[0] ? f[0] : '').split('-', 3); var t = (f[1] ? f[1] : '').split(':', 3); return (new Date( parseInt(d[0], 10) || null, (parseInt(d[1], 10) || 1) - 1, parseInt(d[2], 10) || null, parseInt(t[0], 10) || null, parseInt(t[1], 10) || null, parseInt(t[2], 10) || null )).getTime(); } // 增加天function AddDays(date, value) { date.setDate(date.getDate()+ value); } // 增加月function AddMonths(date, value) { date.setMonth(date.getMonth()+ value); } // 增加年function AddYears(date, value) { date.setFullYear(date.getFullYear()+ value); } // 是否為今天function IsToday(date) { return IsDateEquals(date, new Date()); } // 是否為明天function IsTmorm(date) { var today = new Date(); AddDays(today,1); return IsDateEquals(date, today); } // 是否為當(dāng)月function IsThisMonth(date) { return IsMonthEquals(date, new Date()); } // 兩個日期的年是否相等function IsMonthEquals(date1, date2) { return date1.getMonth() == date2.getMonth() && date1.getFullYear() == date2.getFullYear(); } // 判斷日期是否相等function IsDateEquals(date1, date2) { return date1.getDate() == date2.getDate() && IsMonthEquals(date1, date2); } // 返回某個日期對應(yīng)的月份的天數(shù)function GetMonthDayCount(date) { switch (date.getMonth() + 1) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6: case 9: case 11: return 30; } //feb: date = new Date(date); var lastd = 28; date.setDate(29); while (date.getMonth() == 1) { lastd++; AddDays(date,1); } return lastd; } // 返回兩位數(shù)的年份function GetHarfYear(date) { var v = date.getYear(); if (v > 9) return v.toString(); return "0" + v; } // 返回月份(修正為兩位數(shù))function GetFullMonth(date) { var v = date.getMonth() + 1; if (v > 9) return v.toString(); return "0" + v; } // 返回日 (修正為兩位數(shù))function GetFullDate(date) { var v = date.getDate(); if (v > 9) return v.toString(); return "0" + v; } // 返回時 (修正為兩位數(shù))function GetFullHour(date) { var v = date.getHours(); if (v > 9) return v.toString(); return "0" + v; } // 返回分 (修正為兩位數(shù))function GetFullMinte(date) { var v = date.getMinutes(); if (v > 9) return v.toString(); return "0" + v; } // 返回秒 (修正為兩位數(shù))function GetFullSec(date) { var v = date.getSeconds(); if (v > 9) return v.toString(); return "0" + v; } // 替換字符串function Replace(str, from, to) { return str.split(from).join(to); } // 格式化日期的表示function FormatDate(date, str) { str= Replace(str, "yyyy", date.getFullYear()); str= Replace(str, "MM", GetFullMonth(date)); str= Replace(str, "dd", GetFullDate(date)); str= Replace(str, "yy", GetHarfYear(date)); str= Replace(str, "M", date.getMonth() + 1); str= Replace(str, "d", date.getDate()); return str; } // 統(tǒng)一日期格式function ConvertDate(str) { str= (str + "").replace(/^s*/g, "").replace(/s*$/g, ""); // 去除前后的空白 var d; if (/^[0-9]{8}$/.test(str)) // 20040226 -> 2004-02-26 { d= new Date(new Number(str.substr(0, 4)), new Number(str.substr(4, 2)) - 1, new Number(str.substr(6, 2))); if (d.getTime()) return d; } d= new Date(str); if (d.getTime()) return d; d= new Date(Replace(str, "-", "/")); if (d.getTime()) return d; return null; } //獲取星期function GetWeek(date) { var week; if (date.getDay() == 0) week = "日"; if (date.getDay() == 1) week = "一"; if (date.getDay() == 2) week = "二"; if (date.getDay() == 3) week = "三"; if (date.getDay() == 4) week = "四"; if (date.getDay() == 5) week = "五"; if (date.getDay() == 6) week = "六"; return week; }
標(biāo)題名稱:json.date.js時間相關(guān)-創(chuàng)新互聯(lián)
網(wǎng)站URL:http://weahome.cn/article/ppogi.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部