List of usage examples for org.joda.time DateTimeConstants MAY
int MAY
To view the source code for org.joda.time DateTimeConstants MAY.
Click Source Link
From source file:com.axelor.apps.base.service.scheduler.SchedulerService.java
License:Open Source License
/** * Mthode qui dtermine la prochaine date d'xcution d'un planificateur pour un rythme annuel * * @param scheduler//from www.ja v a2 s . co m * Instance de planificateur * @param date * Derniere date d'xcution thorique * * @return LocalDate * Prochaine date d'xcution */ private LocalDate getAnnualComputeDate(Scheduler scheduler, LocalDate date) { int monthOfYear = 0; if (scheduler.getMonthAnnuallySelect().equals(IAdministration.JAN)) monthOfYear = DateTimeConstants.JANUARY; else if (scheduler.getMonthAnnuallySelect().equals(IAdministration.FEB)) monthOfYear = DateTimeConstants.FEBRUARY; else if (scheduler.getMonthAnnuallySelect().equals(IAdministration.MAR)) monthOfYear = DateTimeConstants.MARCH; else if (scheduler.getMonthAnnuallySelect().equals(IAdministration.APR)) monthOfYear = DateTimeConstants.APRIL; else if (scheduler.getMonthAnnuallySelect().equals(IAdministration.MAY)) monthOfYear = DateTimeConstants.MAY; else if (scheduler.getMonthAnnuallySelect().equals(IAdministration.JUN)) monthOfYear = DateTimeConstants.JUNE; else if (scheduler.getMonthAnnuallySelect().equals(IAdministration.JUL)) monthOfYear = DateTimeConstants.JULY; else if (scheduler.getMonthAnnuallySelect().equals(IAdministration.AUG)) monthOfYear = DateTimeConstants.AUGUST; else if (scheduler.getMonthAnnuallySelect().equals(IAdministration.SEP)) monthOfYear = DateTimeConstants.SEPTEMBER; else if (scheduler.getMonthAnnuallySelect().equals(IAdministration.OCT)) monthOfYear = DateTimeConstants.OCTOBER; else if (scheduler.getMonthAnnuallySelect().equals(IAdministration.NOV)) monthOfYear = DateTimeConstants.NOVEMBER; else if (scheduler.getMonthAnnuallySelect().equals(IAdministration.DEC)) monthOfYear = DateTimeConstants.DECEMBER; if (monthOfYear != 0) { int start = date.plusWeeks(scheduler.getWeekWeekly()).dayOfMonth().getMinimumValue(); int end = date.plusWeeks(scheduler.getWeekWeekly()).dayOfMonth().getMaximumValue(); if (start <= scheduler.getDayAnnually() && scheduler.getDayAnnually() <= end) return date.plusYears(scheduler.getYearAnnually()).withMonthOfYear(monthOfYear) .withDayOfMonth(scheduler.getDayAnnually()); else if (scheduler.getDayMonthly() < start) return date.plusYears(scheduler.getYearAnnually()).withMonthOfYear(monthOfYear).dayOfMonth() .withMinimumValue(); else if (scheduler.getDayMonthly() > end) return date.plusYears(scheduler.getYearAnnually()).withMonthOfYear(monthOfYear).dayOfMonth() .withMaximumValue(); } return null; }
From source file:com.fourmob.datetimepicker.Utils.java
License:Open Source License
public static int getDaysInMonth(final int month, final int year) { switch (month) { default:/*from ww w . j av a 2 s . c om*/ throw new IllegalArgumentException("Invalid Month"); case DateTimeConstants.JANUARY: case DateTimeConstants.MARCH: case DateTimeConstants.MAY: case DateTimeConstants.JULY: case DateTimeConstants.AUGUST: case DateTimeConstants.OCTOBER: case DateTimeConstants.DECEMBER: return 31; case DateTimeConstants.APRIL: case DateTimeConstants.JUNE: case DateTimeConstants.SEPTEMBER: case DateTimeConstants.NOVEMBER: return 30; case DateTimeConstants.FEBRUARY: if ((year % 4) == 0) { return 29; } return 28; } }
From source file:com.helger.datetime.holiday.mgr.XMLUtil.java
License:Apache License
/** * Returns the {@link DateTimeConstants} value for the given month. * /*from w w w. j ava2s . c om*/ * @param eMonth * Month of year to convert * @return {@link DateTimeConstants} value. */ @Nonnegative public static int getMonth(@Nonnull final Month eMonth) { switch (eMonth) { case JANUARY: return DateTimeConstants.JANUARY; case FEBRUARY: return DateTimeConstants.FEBRUARY; case MARCH: return DateTimeConstants.MARCH; case APRIL: return DateTimeConstants.APRIL; case MAY: return DateTimeConstants.MAY; case JUNE: return DateTimeConstants.JUNE; case JULY: return DateTimeConstants.JULY; case AUGUST: return DateTimeConstants.AUGUST; case SEPTEMBER: return DateTimeConstants.SEPTEMBER; case OCTOBER: return DateTimeConstants.OCTOBER; case NOVEMBER: return DateTimeConstants.NOVEMBER; case DECEMBER: return DateTimeConstants.DECEMBER; default: throw new IllegalArgumentException("Unknown month " + eMonth); } }
From source file:com.jjlharrison.jollyday.util.XMLUtil.java
License:Apache License
/** * Returns the <code>DateTimeConstants</code> value for the given month. * * @param month/*from ww w . j a v a 2s .co m*/ * a {@link com.jjlharrison.config.Month} object. * @return DateTimeConstants value. */ public int getMonth(Month month) { switch (month) { case JANUARY: return DateTimeConstants.JANUARY; case FEBRUARY: return DateTimeConstants.FEBRUARY; case MARCH: return DateTimeConstants.MARCH; case APRIL: return DateTimeConstants.APRIL; case MAY: return DateTimeConstants.MAY; case JUNE: return DateTimeConstants.JUNE; case JULY: return DateTimeConstants.JULY; case AUGUST: return DateTimeConstants.AUGUST; case SEPTEMBER: return DateTimeConstants.SEPTEMBER; case OCTOBER: return DateTimeConstants.OCTOBER; case NOVEMBER: return DateTimeConstants.NOVEMBER; case DECEMBER: return DateTimeConstants.DECEMBER; default: throw new IllegalArgumentException("Unknown month " + month); } }
From source file:ee.ut.soras.ajavtV2.mudel.ajavaljend.arvutus.SemLeidmiseAbimeetodid.java
License:Open Source License
/** * Viib ajapunkti <tt>dateTime</tt> kvartali <tt>quarter</tt> keskmisele kuule. *//*from w ww. ja v a 2s. c om*/ public static LocalDateTime setMiddleOfQuarterOfYear(LocalDateTime dateTime, String quarter) { if (quarter.equals("Q1")) { return dateTime.withMonthOfYear(DateTimeConstants.FEBRUARY); } if (quarter.equals("Q2")) { return dateTime.withMonthOfYear(DateTimeConstants.MAY); } if (quarter.equals("Q3")) { return dateTime.withMonthOfYear(DateTimeConstants.AUGUST); } if (quarter.equals("Q4")) { return dateTime.withMonthOfYear(DateTimeConstants.NOVEMBER); } return dateTime; }
From source file:ee.ut.soras.ajavtV2.util.SemDefValjadeParsija.java
License:Open Source License
/** * Tagastab s6nele vastava konstandi klassist <tt>org.joda.time.DateTimeConstants</tt>. *//*w w w. j a v a2 s . c o m*/ public static int parseValueFromConstant(String dateTimeConstant) { // ------------------- AM_PM ------------------------ if (dateTimeConstant.equals("AM")) { return DateTimeConstants.AM; } if (dateTimeConstant.equals("PM")) { return DateTimeConstants.PM; } // ------------------- Nadalapaevad ------------------------ if (dateTimeConstant.equals("MONDAY")) { return DateTimeConstants.MONDAY; } if (dateTimeConstant.equals("TUESDAY")) { return DateTimeConstants.TUESDAY; } if (dateTimeConstant.equals("WEDNESDAY")) { return DateTimeConstants.WEDNESDAY; } if (dateTimeConstant.equals("THURSDAY")) { return DateTimeConstants.THURSDAY; } if (dateTimeConstant.equals("FRIDAY")) { return DateTimeConstants.FRIDAY; } if (dateTimeConstant.equals("SATURDAY")) { return DateTimeConstants.SATURDAY; } if (dateTimeConstant.equals("SUNDAY")) { return DateTimeConstants.SUNDAY; } // --------------------- Kuud ------------------------------ if (dateTimeConstant.equals("JANUARY")) { return DateTimeConstants.JANUARY; } if (dateTimeConstant.equals("FEBRUARY")) { return DateTimeConstants.FEBRUARY; } if (dateTimeConstant.equals("MARCH")) { return DateTimeConstants.MARCH; } if (dateTimeConstant.equals("APRIL")) { return DateTimeConstants.APRIL; } if (dateTimeConstant.equals("MAY")) { return DateTimeConstants.MAY; } if (dateTimeConstant.equals("JUNE")) { return DateTimeConstants.JUNE; } if (dateTimeConstant.equals("JULY")) { return DateTimeConstants.JULY; } if (dateTimeConstant.equals("AUGUST")) { return DateTimeConstants.AUGUST; } if (dateTimeConstant.equals("SEPTEMBER")) { return DateTimeConstants.SEPTEMBER; } if (dateTimeConstant.equals("OCTOBER")) { return DateTimeConstants.OCTOBER; } if (dateTimeConstant.equals("NOVEMBER")) { return DateTimeConstants.NOVEMBER; } if (dateTimeConstant.equals("DECEMBER")) { return DateTimeConstants.DECEMBER; } return Integer.MIN_VALUE; }