Calendar cal = Calendar.getInstance(); // int year = cal.get(Calendar.YEAR);// 獲取年份 int month = cal.get(Calendar.MONTH);// 獲取月份 int day = cal.get(Calendar.DATE);// 獲取日 int hour = cal.get(Calendar.HOUR);// 小時 // int minute = cal.get(Calendar.MINUTE);// 分 // int second = cal.get(Calendar.SECOND);// 秒 int DAY_OF_WEEK = cal.get(Calendar.DAY_OF_WEEK);// 一週的第幾天 int customNumber = day + month; customNumber += hour * 6 + DAY_OF_WEEK; //若是超過195 if (customNumber>195) { customNumber=196; }code
效果圖 今天申請多少人 還剩餘多少人get
public String wholeHouseCustom(ModelMap modelMap, HttpServletRequest req, HttpServletResponse res, Integer pageSize) { Calendar cal = Calendar.getInstance(); // int year = cal.get(Calendar.YEAR);// 獲取年份 int month = cal.get(Calendar.MONTH);// 獲取月份 int day = cal.get(Calendar.DATE);// 獲取日 int hour = cal.get(Calendar.HOUR_OF_DAY);// 小時 int minute = cal.get(Calendar.MINUTE);// 分 // int second = cal.get(Calendar.SECOND);// 秒 int DAY_OF_WEEK = cal.get(Calendar.DAY_OF_WEEK);// 一週的第幾天 int customNumber = day + month; customNumber += hour * 6 + DAY_OF_WEEK+minute/10; //若是超過195 if (customNumber>195) { customNumber=196; } modelMap.addAttribute("customNumber", customNumber); modelMap.addAttribute("leaveNumber", 200 - customNumber); return "/public/custom/custom"; }
小時 須要從新設置model