List of usage examples for org.joda.time YearMonth minusMonths
public YearMonth minusMonths(int months)
From source file:org.openmrs.module.mirebalaisreports.fragment.controller.field.MonthSinceMirebalaisOpeningFragmentController.java
License:Open Source License
public void controller(FragmentModel model) { List<SimpleObject> months = new ArrayList<SimpleObject>(); YearMonth earliest = new YearMonth(2013, 2); YearMonth month = new YearMonth().minusMonths(1); while (month.isAfter(earliest)) { months.add(SimpleObject.create("label", month.toString("MMM yyyy", Context.getLocale()), "value", month.toString("yyyy-MM-01"))); month = month.minusMonths(1); }//from ww w .ja va2 s. com model.addAttribute("months", months); }