SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
public boolean verifyMovieTime(Date date) throws NumberFormatException, ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmm");
Long a = Long.parseLong(getMovieBeginTime(date) + "1200");
Long b = Long.parseLong(getMovieEndTime(date) + "1200");
Long c = Long.parseLong(dateFormat.format(date));
if (c > a && c < b) {
return true; }
return false; }
public String getMovieEndTime(Date computeDate) throws ParseException {
this.c.setTime(computeDate);
int i = c.get(Calendar.DAY_OF_WEEK);
if (i == 1) { c.add(c.DAY_OF_WEEK, -2); } else if (i == 2) { c.add(c.DAY_OF_WEEK, 4); } else if (i == 6) { c.add(c.DAY_OF_WEEK, 0); } else if (i == 7) { c.add(c.DAY_OF_WEEK, -1); } else if (i > 2 && i < 6) { c.add(c.DAY_OF_WEEK, 6 - i); }
Date beginDate = this.c.getTime();
String str = this.dateFormat.format(beginDate);
return str; }
public String getMovieBeginTime(Date computeDate) throws ParseException {
this.c.setTime(computeDate);
int i = c.get(Calendar.DAY_OF_WEEK);
if (i == 2) { c.add(c.DAY_OF_WEEK, 0); } else if (i > 2) { c.add(c.DAY_OF_WEEK, 2 - i); } else if (i == 1) { c.add(c.DAY_OF_WEEK, -6); }
Date beginDate = this.c.getTime();
String str = this.dateFormat.format(beginDate);
return str; }
public String getRankingBeginTime(Date computeDate) throws ParseException {