List of usage examples for org.apache.commons.lang3.time DateUtils addYears
public static Date addYears(final Date date, final int amount)
From source file:com.progym.custom.fragments.WaterProgressYearlyLineFragment.java
@Click void ivPrevYear() { ivNextYear.startAnimation(fadeIn);//from w ww . j av a2 s .c o m rightOut.setDuration(1000); rightOut.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { DATE = DateUtils.addYears(DATE, -1); } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { setLineData3(DATE, true); } }); mChartView.startAnimation(rightOut); }
From source file:com.thoughtworks.go.security.X509CertificateGeneratorTest.java
@Test public void shouldCreateCertWithDnThatIsValidFromEpochToNowPlusTenYears() throws Exception { X509CertificateGenerator generator = new X509CertificateGenerator(); Registration certChain = generator.createCertificateWithDn("CN=hostname"); Date epoch = new Date(0); X509Certificate cert = certChain.getFirstCertificate(); cert.checkValidity(epoch); // does not throw CertificateNotYetValidException cert.checkValidity(DateUtils.addYears(new Date(), 9)); // does not throw CertificateNotYetValidException }
From source file:com.lk.ofo.util.DateUtil.java
/** * ????0/*from www .ja v a 2 s . co m*/ * * @param * @return */ public static Date getAfterYear(int addYear) { Date currentDate = new Date(); Date date = DateUtils.addYears(currentDate, addYear); date = DateUtils.setHours(date, 0); date = DateUtils.setMinutes(date, 0); date = DateUtils.setSeconds(date, 0); date = DateUtils.setMilliseconds(date, 0); return date; }
From source file:com.progym.custom.fragments.CalloriesProgressYearlyLineFragment.java
@Click void ivPrevYear() { ivPrevYear.startAnimation(fadeIn);//from w w w .j ava 2 s .co m rightOut.setDuration(1000); rightOut.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { DATE = DateUtils.addYears(DATE, -1); } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { setYearProgressData(DATE, true); } }); viewChart.startAnimation(rightOut); }
From source file:com.progym.custom.fragments.FoodProgressYearlyLineFragment.java
@Click void ivNextYear() { ivNextYear.startAnimation(fadeIn);/* w w w. j a va 2 s .c o m*/ leftOut.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { DATE = DateUtils.addYears(DATE, 1); } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { setYearProgressData(DATE, false); } }); viewChart.startAnimation(leftOut); }
From source file:com.progym.custom.fragments.WaterProgressYearlyLineFragment.java
@Click void ivNextYear() { ivNextYear.startAnimation(fadeIn);//w ww . j a va2s. c om leftOut.setDuration(1000); leftOut.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { DATE = DateUtils.addYears(DATE, 1); } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { setLineData3(DATE, false); } }); mChartView.startAnimation(leftOut); }
From source file:io.lavagna.service.EventRepositoryTest.java
@Before public void prepare() { Helper.createUser(userRepository, "test", "test-user"); user = userRepository.findUserByName("test", "test-user"); Helper.createUser(userRepository, "test", "test-user-alt"); userAlt = userRepository.findUserByName("test", "test-user-alt"); project = projectService.create("test", "TEST", "desc"); board = boardRepository.createNewBoard("test-board", "TEST-BRD", null, projectService.findByShortName("TEST").getId()); List<BoardColumnDefinition> definitions = projectService .findColumnDefinitionsByProjectId(projectService.findByShortName("TEST").getId()); for (BoardColumnDefinition def : definitions) { if (def.getValue() == ColumnDefinition.OPEN) { col1 = boardColumnRepository.addColumnToBoard("col1", def.getId(), BoardColumnLocation.BOARD, board.getId());/*from w w w . j a v a 2 s. c o m*/ } } cardService.createCard("card1", col1.getId(), new Date(), user); List<CardFull> cards = cardRepository.findAllByColumnId(col1.getId()); card1 = cards.get(0); oneYearAgo = DateUtils.addYears(new Date(), -1); }
From source file:com.progym.custom.fragments.CalloriesProgressYearlyLineFragment.java
@Click void ivNextYear() { ivNextYear.startAnimation(fadeIn);//from w w w .j a va2 s . c o m leftOut.setDuration(1000); leftOut.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { DATE = DateUtils.addYears(DATE, 1); } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { setYearProgressData(DATE, false); } }); viewChart.startAnimation(leftOut); }
From source file:io.lavagna.service.StatisticsServiceTest.java
@Before public void prepare() { Helper.createUser(userRepository, "test", "test-user"); user = userRepository.findUserByName("test", "test-user"); Project p = projectService.create("test", "TEST", "desc"); board = boardRepository.createNewBoard("test-board", "TEST-BRD", null, p.getId()); List<BoardColumnDefinition> definitions = projectService .findColumnDefinitionsByProjectId(projectService.findByShortName("TEST").getId()); for (BoardColumnDefinition def : definitions) { if (def.getValue() == ColumnDefinition.OPEN) { openCol = boardColumnRepository.addColumnToBoard("col1", def.getId(), BoardColumn.BoardColumnLocation.BOARD, board.getId()); }/*from ww w.j a v a 2 s .com*/ } today = DateUtils.truncate(new Date(), Calendar.DATE); yesterday = DateUtils.addDays(today, -1); oneMonthAgo = DateUtils.addMonths(today, -1); lastSnapshot = DateUtils.addYears(today, -10); card = cardService.createCard("card1", openCol.getId(), today, user); assigned = cardLabelRepository.findLabelByName(p.getId(), "ASSIGNED", CardLabel.LabelDomain.SYSTEM); customLabel = cardLabelRepository.addLabel(p.getId(), true, CardLabel.LabelType.USER, CardLabel.LabelDomain.USER, "Custom label", 0); labelValueToUser = new CardLabelValue.LabelValue(null, null, null, null, user.getId(), null); }
From source file:eu.ggnet.dwoss.report.entity.Report.java
/** * Returns all Lines of the Report for Category Invoiced, split by mfgDate - startOfReport < 1 year and the rest. * This consists of:/*w w w . j a v a 2 s . c o m*/ * <ul> * <li>Position of Type Invoice, with no References</li> * <li>Position of Type UNIT_ANNEX in DocumentType CREDIT_MEMO/ANNULATIION_INVOICE and a Referencing Invoice in the same report.</li> * </ul> * <p> * @return all Lines of the Report for Category Invoiced. */ public YearSplit filterInvoicedSplit() { NavigableSet<ReportLine> pastSplit = filterInvoiced(); NavigableSet<ReportLine> preSplit = new TreeSet<>(); Date splitter = DateUtils.addYears(startingDate, -1); for (ReportLine line : pastSplit) { if (splitter.before(line.getMfgDate())) preSplit.add(line); } pastSplit.removeAll(preSplit); return new YearSplit(startingDate, preSplit, pastSplit); }