軟體開發的目錄規範
阿新 • • 發佈:2020-12-11
/** * 獲取時間 * day_count 是多少天 * */
getDays(day_count) { var date = new Date() var date1 = new Date() var timeLimit = 23 * 60 * 60 var nowTime = date.getHours() * 60 * 60 + date.getMinutes() * 60 + date.getSeconds() var dates = [] var tempdates = [] var week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'] for (var i = 0; i <= day_count; i++) { var d = null ' ' if (timeLimit > nowTime) { // date1 = date.getDate()+1 date1.setTime(date1.getTime() + 24 * 60 * 60 * 1000) } else { // date1 = date.getDate()+2 date1.setTime(date1.getTime() + 24 * 60 * 60 * 1000 * 2) } var month = date1.getMonth() + 1 var dateStr = date1.getDate() if (month < 10) { month = '0' + month } if (dateStr < 10) { dateStr = '0' + dateStr } d = date1.getFullYear() + '-' + month + '-' + dateStr var weeks = '' var day = new Date(d) var z = day.getDay() weeks = week[z] var a = d + '(' + weeks + ')' dates.push(a) tempdates.push(d) date.setDate(date.getDate() + 1) } this.multiArray[0] = dates this.agreedDeliveryDateList = tempdates },
//呼叫函式,以未來7天為例 getDays(7);