List of usage examples for org.joda.time DateTimeConstants APRIL
int APRIL
To view the source code for org.joda.time DateTimeConstants APRIL.
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 w ww . ja v a 2 s . c om*/ * 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:// www. j a va 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 ww w .j av a 2s .co m * @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.helger.datetime.holiday.parser.impl.RelativeToEasterSundayParser.java
License:Apache License
/** * Returns the easter Sunday within the julian chronology. * /*w ww . j a v a 2 s .com*/ * @param nYear * The year to retrieve Julian Easter Sunday date * @return julian easter Sunday */ public static LocalDate getJulianEasterSunday(final int nYear) { int a, b, c, d, e; int x, nMonth, nDay; a = nYear % 4; b = nYear % 7; c = nYear % 19; d = (19 * c + 15) % 30; e = (2 * a + 4 * b - d + 34) % 7; x = d + e + 114; nMonth = x / 31; nDay = (x % 31) + 1; return new LocalDate(nYear, (nMonth == 3 ? DateTimeConstants.MARCH : DateTimeConstants.APRIL), nDay, JulianChronology.getInstance()); }
From source file:com.helger.datetime.holiday.parser.impl.RelativeToEasterSundayParser.java
License:Apache License
/** * Returns the easter Sunday within the gregorian chronology. * //ww w .ja va 2 s . c o m * @param nYear * The year to retrieve Gregorian Easter Sunday date * @return gregorian easter Sunday. */ public static LocalDate getGregorianEasterSunday(final int nYear) { int a, b, c, d, e, f, g, h, i, j, k, l; int x, nMonth, nDay; a = nYear % 19; b = nYear / 100; c = nYear % 100; d = b / 4; e = b % 4; f = (b + 8) / 25; g = (b - f + 1) / 3; h = (19 * a + b - d - g + 15) % 30; i = c / 4; j = c % 4; k = (32 + 2 * e + 2 * i - h - j) % 7; l = (a + 11 * h + 22 * k) / 451; x = h + k - 7 * l + 114; nMonth = x / 31; nDay = (x % 31) + 1; return new LocalDate(nYear, (nMonth == 3 ? DateTimeConstants.MARCH : DateTimeConstants.APRIL), nDay, GregorianChronology.getInstance(PDTConfig.getDefaultDateTimeZone())); }
From source file:com.jjlharrison.jollyday.util.CalendarUtil.java
License:Apache License
/** * Returns the easter sunday within the julian chronology. * * @param year/* w ww . j a v a2 s . co m*/ * a int. * @return julian easter sunday */ public LocalDate getJulianEasterSunday(int year) { int a, b, c, d, e; int x, month, day; a = year % 4; b = year % 7; c = year % 19; d = (19 * c + 15) % 30; e = (2 * a + 4 * b - d + 34) % 7; x = d + e + 114; month = x / 31; day = (x % 31) + 1; LocalDate julianEasterDate = create(year, (month == 3 ? DateTimeConstants.MARCH : DateTimeConstants.APRIL), day, JulianChronology.getInstanceUTC()); return convertToISODate(julianEasterDate); }
From source file:com.jjlharrison.jollyday.util.CalendarUtil.java
License:Apache License
/** * Returns the easter sunday within the gregorian chronology. * * @param year//from w w w.ja va 2s .com * a int. * @return gregorian easter sunday. */ public LocalDate getGregorianEasterSunday(int year) { int a, b, c, d, e, f, g, h, i, j, k, l; int x, month, day; a = year % 19; b = year / 100; c = year % 100; d = b / 4; e = b % 4; f = (b + 8) / 25; g = (b - f + 1) / 3; h = (19 * a + b - d - g + 15) % 30; i = c / 4; j = c % 4; k = (32 + 2 * e + 2 * i - h - j) % 7; l = (a + 11 * h + 22 * k) / 451; x = h + k - 7 * l + 114; month = x / 31; day = (x % 31) + 1; return create(year, (month == 3 ? DateTimeConstants.MARCH : DateTimeConstants.APRIL), day); }
From source file:com.jjlharrison.jollyday.util.XMLUtil.java
License:Apache License
/** * Returns the <code>DateTimeConstants</code> value for the given month. * * @param month// w ww .j a v a2s . c o 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> aastaaja <tt>season</tt> keskmisele kuule. *//*from w ww.ja v a 2s.c o m*/ public static LocalDateTime setMiddleOfSeason(LocalDateTime dateTime, String season) { if (season.equals("WI")) { return dateTime.withMonthOfYear(DateTimeConstants.JANUARY); } if (season.equals("SP")) { return dateTime.withMonthOfYear(DateTimeConstants.APRIL); } if (season.equals("SU")) { return dateTime.withMonthOfYear(DateTimeConstants.JULY); } if (season.equals("FA")) { return dateTime.withMonthOfYear(DateTimeConstants.OCTOBER); } 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>. *///from ww w . ja va2 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; }