List of usage examples for java.util Date after
public boolean after(Date when)
From source file:com.sun.socialsite.util.DateUtil.java
/** * Parse data as either 6-char or 8-char format. *//*from ww w . j a v a 2s .co m*/ public static Date parseWeblogURLDateString(String dateString, TimeZone tz, Locale locale) { Date ret = new Date(); DateFormat char8DateFormat = DateUtil.get8charDateFormat(); DateFormat char6DateFormat = DateUtil.get6charDateFormat(); if (dateString != null && dateString.length() == 8 && StringUtils.isNumeric(dateString)) { ParsePosition pos = new ParsePosition(0); ret = char8DateFormat.parse(dateString, pos); // make sure the requested date is not in the future Date today = null; Calendar todayCal = Calendar.getInstance(); todayCal = Calendar.getInstance(tz, locale); todayCal.setTime(new Date()); today = todayCal.getTime(); if (ret.after(today)) { ret = today; } } else if (dateString != null && dateString.length() == 6 && StringUtils.isNumeric(dateString)) { ParsePosition pos = new ParsePosition(0); ret = char6DateFormat.parse(dateString, pos); // make sure the requested date is not in the future Calendar todayCal = Calendar.getInstance(); todayCal = Calendar.getInstance(tz, locale); todayCal.setTime(new Date()); Date today = todayCal.getTime(); if (ret.after(today)) { ret = today; } } return ret; }
From source file:be.fedict.eid.pkira.common.util.FilterHelperBean.java
@Override public boolean filterByDate(Date actualDate, Date dateFrom, Date dateTo) { if (dateFrom != null) { dateFrom = changeTime(dateFrom, 0, 0, 0); if (dateFrom.after(actualDate)) { return false; }//from w w w . j a v a 2 s . c o m } if (dateTo != null) { dateTo = changeTime(dateTo, 23, 59, 59); if (dateTo.before(actualDate)) { return false; } } return true; }
From source file:com.apus.hades.admin.task.AdSchedulingUpDownTask.java
private void processConfig(JSONObject config) throws Exception { int did = config.getInt("did"); Long id = config.getLong("id"); Status status = Status.getByValue(config.getInt("status")); String time = config.getString("time"); Date date = DateUtil.strToDate(time, "yyyyMMddHHmmss"); if (did == 1) { return;/*from www . j a v a 2 s .com*/ } if (date.after(new Date())) { return; } RealPlatformInfo real = positionManager.findRealPlatformInfo(id); if (null == real) { return; } real.setStatus(status); positionManager.updateRealPlatformInfo(real); for (String c : cmds) { if (!this.synAPI(c)) { return; } } config.put("did", 1); success++; }
From source file:com.stevpet.sonar.plugins.dotnet.mscover.datefilter.CutOffDateFilter.java
private Date getLatestCommitDate() { if (lineCommitsData == null || lineCommitsData.isEmpty()) { LOG.debug("No history found for file"); return null; }/*from www . ja va 2 s .c om*/ Date latestCommitDate = getGenesis(); for (Date commitDate : lineCommitsData.values()) { if (commitDate.after(latestCommitDate)) { latestCommitDate = commitDate; } } return latestCommitDate; }
From source file:org.ngrinder.operation.service.AnnouncementService.java
/** * Check the announcement was changed since 1 week ago. * /*from www .jav a 2s . co m*/ * @return true if it's new one */ public boolean isNew() { Date announcementDate = config.getAnnouncementDate(); if (announcementDate != null) { Date weekAgo = DateUtils.addDays(new Date(), -7); return announcementDate.after(weekAgo); } else { return false; } }
From source file:br.com.surittec.surivalidation.validator.DateRangeValidator.java
@Override public boolean isValid(Date value, ConstraintValidatorContext context) { if (nullable && value == null) return true; if ((minDate == null || !value.before(minDate)) && (maxDate == null || !value.after(maxDate))) { return true; }/*from w w w. j a va2 s . co m*/ return false; }
From source file:TripServlet.java
void filterTrips(Date lastdate) { filterdtrips.clear();/*from ww w . j a v a 2 s . com*/ Date today = new Date(); for (int i = 0; i < alltrips.size(); i++) { Date d = alltrips.get(i).start_Date; if (d.after(lastdate) || DateUtils.isSameDay(d, today)) { filterdtrips.add(alltrips.get(i)); } } }
From source file:gov.nih.nci.firebird.nes.common.AbstractBaseNesService.java
/** * Indicates whether a record is stale according to the lastNesRefresh date. * // w w w . ja va 2 s . c o m * @param lastNesRefresh date of last NES refresh * @return true if record is considered stale and requires refresh */ protected boolean isStale(Date lastNesRefresh) { Date now = new Date(); return lastNesRefresh == null || now.after(DateUtils.addDays(lastNesRefresh, 1)); }
From source file:com.esofthead.mycollab.module.project.domain.ProjectGenericTask.java
public boolean isOverdue() { if (getDueDate() != null && !isClosed()) { Date currentDay = DateTimeUtils.getCurrentDateWithoutMS(); return currentDay.after(getDueDate()); }/*from ww w . java 2 s.c o m*/ return false; }
From source file:org.springframework.test.web.servlet.htmlunit.MockMvcWebConnection.java
private void storeCookies(WebRequest webRequest, javax.servlet.http.Cookie[] cookies) { if (cookies == null) { return;//w ww.j a v a 2 s. c om } Date now = new Date(); CookieManager cookieManager = this.webClient.getCookieManager(); for (javax.servlet.http.Cookie cookie : cookies) { if (cookie.getDomain() == null) { cookie.setDomain(webRequest.getUrl().getHost()); } Cookie toManage = createCookie(cookie); Date expires = toManage.getExpires(); if (expires == null || expires.after(now)) { cookieManager.addCookie(toManage); } else { cookieManager.removeCookie(toManage); } } }