List of usage examples for org.joda.time LocalDate LocalDate
public LocalDate()
From source file:com.bgh.myopeninvoice.jsf.jsfbeans.InvoiceBean.java
License:Apache License
public void addNewInvoiceListener(ActionEvent event) { selectedInvoiceEntity = new InvoiceEntity(); selectedInvoiceEntity.setNote("All currency amounts are in CAD unless specified otherwise."); selectedInvoiceEntity.setCreatedDate(new Date()); selectedInvoiceEntity.setFromDate(new LocalDate().minusMonths(1).withDayOfMonth(1).toDate()); selectedInvoiceEntity.setToDate(new LocalDate().minusMonths(1).dayOfMonth().withMaximumValue().toDate()); selectedInvoiceEntity.setDueDate(new LocalDate().withDayOfMonth(15).toDate()); selectedInvoiceEntity.setInvoiceItemsByInvoiceId(new ArrayList<>()); //for value calculation selectedInvoiceItemsEntity = null;/* www . j a v a 2 s . c o m*/ contractsEntityCollectionForSelection = null; }
From source file:com.c2a.vie.managedbeans.deces.ContratgroupeManagedBean.java
public int ageassure() { Calendar calendar = new GregorianCalendar(); LocalDate aujourdui = new LocalDate(); calendar.setTime(selectassurepret.getDatnaisassure()); int annee = calendar.get(Calendar.YEAR); int mois = calendar.get(Calendar.MONTH); int jours = calendar.get(Calendar.DAY_OF_MONTH); LocalDate naissance = new LocalDate(annee, mois, jours); Period p = new Period(naissance, aujourdui, PeriodType.yearMonthDay()); return p.getYears(); }
From source file:com.c2a.vie.managedbeans.deces.ContratgroupeManagedBean.java
public int ageassureren() { Calendar calendar = new GregorianCalendar(); LocalDate aujourdui = new LocalDate(); calendar.setTime(selectrnouvelmentcontrat.getCodassure().getDatnaisassure()); int annee = calendar.get(Calendar.YEAR); int mois = calendar.get(Calendar.MONTH); int jours = calendar.get(Calendar.DAY_OF_MONTH); LocalDate naissance = new LocalDate(annee, mois, jours); Period p = new Period(naissance, aujourdui, PeriodType.yearMonthDay()); return p.getYears(); }
From source file:com.cedarsoft.history.core.DefaultDiscreteHistoryEntry.java
License:Open Source License
/** * Creates a new entry with the current date as validity and verification date */ public DefaultDiscreteHistoryEntry() { this(new LocalDate()); }
From source file:com.cedarsoft.history.core.DefaultDiscreteHistoryEntry.java
License:Open Source License
/** * Creates a new entry/*w w w .jav a 2s . com*/ * * @param validityDate the validity date */ public DefaultDiscreteHistoryEntry(@Nonnull LocalDate validityDate) { this(validityDate, new LocalDate()); }
From source file:com.cedarsoft.history.core.DefaultHistoryEntry.java
License:Open Source License
/** * Creates a new default entry with the current datetime as verification date */ public DefaultHistoryEntry() { this(new LocalDate()); }
From source file:com.cronutils.htime.DateTimeFormatParser.java
License:Apache License
@VisibleForTesting Map<String, String> initDaysOfWeek(Locale locale) { String fullDoW = String.format("%s%s%s%s", constants.dayOfWeekName(), constants.dayOfWeekName(), constants.dayOfWeekName(), constants.dayOfWeekName()); LocalDate date = new LocalDate(); Map<String, String> mapping = Maps.newHashMap(); for (int j = 1; j < 8; j++) { String dow = date.withDayOfWeek(j).dayOfWeek().getAsText(locale).toLowerCase(); mapping.put(dow, fullDoW);// w w w . j av a 2 s. c o m mapping.put(dow.substring(0, 3), constants.dayOfWeekName()); } return mapping; }
From source file:com.cronutils.htime.DateTimeFormatParser.java
License:Apache License
@VisibleForTesting Map<String, String> initMonths(Locale locale) { String fullMonth = String.format("%s%s%s%s", constants.monthOfYear(), constants.monthOfYear(), constants.monthOfYear(), constants.monthOfYear()); String shortMonth = String.format("%s%s%s", constants.monthOfYear(), constants.monthOfYear(), constants.monthOfYear());//w ww .j a v a2s. co m LocalDate date = new LocalDate(); Map<String, String> mapping = Maps.newHashMap(); for (int j = 1; j < 13; j++) { String moy = date.withMonthOfYear(j).monthOfYear().getAsText(locale).toLowerCase(); mapping.put(moy, fullMonth); mapping.put(moy.substring(0, 3), shortMonth); } return mapping; }
From source file:com.einzig.ipst2.activities.MainActivity.java
License:Open Source License
public void formatUIFromRadio(int viewID) { PreferencesHelper helper = new PreferencesHelper(this); Button viewList = (Button) findViewById(R.id.viewlist_mainactivity); switch (viewID) { case R.id.todaytab_mainactivity: viewDate = new LocalDate(); viewList.setText(R.string.viewlisttoday); break;/*from w ww .j a v a2 s. c o m*/ case R.id.weektab_mainactivity: viewDate = new LocalDate().minusDays(7); viewList.setText(R.string.viewlistweek); break; case R.id.monthtab_mainactivity: viewDate = new LocalDate().minusMonths(1); viewList.setText(R.string.viewlistmonth); break; case R.id.alltab_mainactivity: viewDate = null; formatUI(db.getAcceptedCount(helper.isSeerOnly()), db.getRejectedCount(helper.isSeerOnly()), db.getPendingCount(helper.isSeerOnly())); viewList.setText(R.string.viewlistall); break; } Logger.d("viewDate -> " + viewDate); if (viewDate == null) formatUI(db.getAcceptedCount(helper.isSeerOnly()), db.getRejectedCount(helper.isSeerOnly()), db.getPendingCount(helper.isSeerOnly())); else formatUI(db.getAcceptedCountByResponseDate(viewDate, helper.isSeerOnly()), db.getRejectedCountByResponseDate(viewDate, helper.isSeerOnly()), db.getPendingCountByDate(viewDate, helper.isSeerOnly())); }
From source file:com.einzig.ipst2.activities.MainActivity.java
License:Open Source License
@OnClick(R.id.viewlist_mainactivity) public void onClickViewList(View view) { Logger.d("View all button clicked"); if (((Button) view).getText().toString().equals(getString(R.string.viewlistall))) { Logger.d("Going to All List"); openList(null, "all"); } else if (((Button) view).getText().toString().equals(getString(R.string.viewlistmonth))) { Logger.d("Going to Month List"); openList(new LocalDate().minusDays(30), "all"); } else if (((Button) view).getText().toString().equals(getString(R.string.viewlistweek))) { Logger.d("Going to Week List"); openList(new LocalDate().minusDays(7), "all"); } else if (((Button) view).getText().toString().equals(getString(R.string.viewlisttoday))) { Logger.d("Going to Today List"); openList(new LocalDate(), "all"); }/*from www. j a v a 2 s.c o m*/ }