List of usage examples for org.apache.commons.lang.time DateUtils addDays
public static Date addDays(Date date, int amount)
From source file:cn.ccrise.spimp.web.LoginController.java
public static void main(String[] args) { String day = new SimpleDateFormat("yyyy-MM-dd") .format(DateUtils.addDays(new Date(System.currentTimeMillis()), 365 * 20)); String license = AES.encodeAes128(KEY, day); System.out.println(license);//from w w w. ja va 2 s . c o m System.out.println(AES.decodeAes128(KEY, license)); }
From source file:com.ocpsoft.socialpm.util.Dates.java
public static Date addDays(final Date date, final int amount) { return DateUtils.addDays(date, amount); }
From source file:com.hs.mail.imap.schedule.ScheduleUtils.java
public static Date getDateBefore(String str) { if (str != null) { int sz = str.length(); for (int i = 0; i < sz; i++) { char ch = str.charAt(i); if (!Character.isDigit(ch)) { try { int amount = Integer.parseInt(str.substring(0, i)); switch (Character.toUpperCase(ch)) { case 'D': return DateUtils.addDays(new Date(), -amount); case 'M': return DateUtils.addMonths(new Date(), -amount); case 'Y': return DateUtils.addYears(new Date(), -amount); }/* ww w . j ava2 s.c om*/ } catch (NumberFormatException e) { break; } } } } return null; }
From source file:com.flywet.platform.lic.LicenseObject.java
public LicenseObject setExpiredDate(int day) { this.expiredDate = new Date(); this.expiredDate = DateUtils.addDays(this.expiredDate, day); return this; }
From source file:de.hybris.platform.accountsummaryaddon.document.B2BDocumentPastDuePredicate.java
@Override public boolean evaluate(final Object doc) { if (!(doc instanceof B2BDocumentModel)) { return false; }//w w w.j a v a2 s .c o m final B2BDocumentModel document = (B2BDocumentModel) doc; final Date now = XDate.setToEndOfDay(DateUtils.addDays(new Date(), -1)); return document.getDueDate() != null && document.getDueDate().getTime() <= now.getTime(); }
From source file:com.clican.pluto.dataprocess.dpl.function.impl.DayOfMonth.java
public Object calculate(Map<String, Object> row) throws CalculationException, PrefixAndSuffixException { Date d = date.getValue(row);//www. ja v a 2s.c o m d = DateUtils.truncate(d, Calendar.MONTH); d = DateUtils.addMonths(d, 1); d = DateUtils.addDays(d, -1); SimpleDateFormat sdf = new SimpleDateFormat("dd"); return Integer.parseInt(sdf.format(d)); }
From source file:com.dianping.lion.vo.OperationLogCriteria.java
public OperationLogCriteria() { this.from = DateUtils.addDays(Calendar.getInstance().getTime(), -7); }
From source file:de.hybris.platform.accountsummaryaddon.document.B2BDocumentDueDateRangePredicate.java
@Override public boolean evaluate(final Object doc) { if (!(doc instanceof B2BDocumentModel)) { return false; }/*from ww w . jav a2 s . co m*/ final B2BDocumentModel document = (B2BDocumentModel) doc; final Date min = XDate.setToEndOfDay(DateUtils.addDays(new Date(), -dateRange.getMinBoundary().intValue())); Date max = null; if (dateRange.getMaxBoundary() != null) { max = DateUtils.truncate(DateUtils.addDays(new Date(), -dateRange.getMaxBoundary().intValue()), Calendar.DAY_OF_MONTH); } return (dateRange.getMaxBoundary() == null || (document.getDueDate() != null && document.getDueDate().getTime() >= max.getTime())) && (document.getDueDate() != null && document.getDueDate().getTime() <= min.getTime()); }
From source file:com.haulmont.timesheets.global.DateTimeUtils.java
public static Date getLastDayOfWeek(Date date) { return DateUtils.addDays(getFirstDayOfWeek(date), 6); }
From source file:net.duckling.ddl.service.devent.AoneNoticeParam.java
public AoneNoticeParam(int tid, String type, String uid) { setTid(tid);/* ww w . j a va 2 s .co m*/ setNoticeType(type); setRecipient(uid); setBeginDate(DateUtils.addDays(new Date(), DEFAULT_DURATION)); setEndDate(new Date()); }