List of usage examples for java.time Month getValue
public int getValue()
From source file:gov.va.isaac.gui.preferences.plugins.ViewCoordinatePreferencesPluginView.java
private boolean dateIsLocalDate(Date d) { Month ldMonth = LocalDate.now().atStartOfDay().getMonth(); int ldDate = LocalDate.now().atStartOfDay().getDayOfMonth(); int ldYear = LocalDate.now().atStartOfDay().getYear(); Calendar cal = Calendar.getInstance(); cal.setTime(d);//from w ww.j av a 2 s . c o m if (cal.get(Calendar.YEAR) == ldYear && cal.get(Calendar.DAY_OF_MONTH) == ldDate && cal.get(Calendar.MONTH) == (ldMonth.getValue() - 1)) { return true; } return false; }
From source file:nl.xs4all.home.freekdb.b52reader.general.Utilities.java
/** * Create a zoned date(/time). The time part is empty. * * @param year year./*from w ww. ja v a 2 s . c om*/ * @param month month. * @param dayOfMonth day of the month. * @return <code>ZonedDateTime</code> object. */ public static ZonedDateTime createDate(final int year, final Month month, final int dayOfMonth) { return ZonedDateTime.of(year, month.getValue(), dayOfMonth, 0, 0, 0, 0, ZoneOffset.UTC); }
From source file:org.efaps.esjp.common.uiform.Field_Base.java
/** * @param _parameter Parameter as passed from the eFaps API * @return Return containing Html Snipplet * @throws EFapsException on error/* ww w . j a va 2 s . c o m*/ */ public Return getOptionList4DateTime(final Parameter _parameter) throws EFapsException { final List<DropDownPosition> positions = new ArrayList<>(); final String dateFieldType = getProperty(_parameter, "DateFieldType", "YEAR"); switch (dateFieldType) { case "MONTH": for (final Month month : Month.values()) { final DropDownPosition pos = getDropDownPosition(_parameter, month.getValue(), month.getDisplayName(TextStyle.FULL, Context.getThreadContext().getLocale())); pos.setSelected(month.getValue() == new DateTime().getMonthOfYear()); positions.add(pos); } break; case "YEAR": default: final String fromStr = getProperty(_parameter, "From", "-10"); final String toStr = getProperty(_parameter, "To", "+10"); LocalDate start; if (StringUtils.isNumeric(fromStr)) { start = LocalDate.of(Integer.parseInt(fromStr), 1, 1); } else { start = LocalDate.now().plusYears(Integer.parseInt(fromStr)); } final LocalDate end; if (StringUtils.isNumeric(toStr)) { end = LocalDate.of(Integer.parseInt(toStr), 1, 1); } else { end = LocalDate.now().plusYears(Integer.parseInt(toStr)); } while (start.isBefore(end)) { final DropDownPosition pos = getDropDownPosition(_parameter, start.getYear(), start.getYear()); pos.setSelected(start.getYear() == new DateTime().getYear()); positions.add(pos); start = start.plusYears(1); } break; } final Return ret = new Return(); ret.put(ReturnValues.VALUES, positions); return ret; }