/** * TODO 验证时间 * @return */ public boolean getWithdrawTime(){ Date date = new Date(); Calendar nowCalendar = Calendar.getInstance(); nowCalendar.setTime(date); if(nowCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || nowCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY){ return false; } if(nowCalendar.compareTo(getStartWithdrawTime(date)) == -1 || nowCalendar.compareTo(getEndWithdrawTime(date)) == 1){ return false; } return true; } /** * TODO 设置开始时间 * @param date * @return */ public Calendar getStartWithdrawTime(Date date){ Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY,8); calendar.set(Calendar.MINUTE,00); return calendar; } /** * TODO 设置结束时间 * @param date * @return */ public Calendar getEndWithdrawTime(Date date){ Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY,20); calendar.set(Calendar.MINUTE,00); return calendar; } 欢迎提供宝贵意见!
新闻热点
疑难解答