List of usage examples for org.joda.time DateTime getMonthOfYear
public int getMonthOfYear()
From source file:com.wealdtech.utils.RangeFormatter.java
License:Open Source License
private boolean isSameMonth(final DateTime lower, final DateTime upper) { return (lower.getYear() == upper.getYear()) && (lower.getMonthOfYear() == upper.getMonthOfYear()); }
From source file:com.yahoo.sql4d.indexeragent.meta.Utils.java
License:Open Source License
public static String month(DateTime dt) { return twoFormat.format(dt.getMonthOfYear()); }
From source file:com.zaradai.kunzite.trader.services.md.eod.compact.CompactEodEncoder.java
License:Apache License
private void writeDate(DataOutput dataOutput, EodData entry) throws IOException { DateTime date = entry.getDate(); dataOutput.writeShort(date.getYear()); dataOutput.writeByte(date.getMonthOfYear()); dataOutput.writeByte(date.getDayOfMonth()); }
From source file:com.zfer.kit.DateKit.java
License:Apache License
/** * get month./*from w w w. j a v a 2 s . co m*/ * * @param date date object * @return month of date */ public static int getMonth(Date date) { DateTime dt = new DateTime(date); return dt.getMonthOfYear(); }
From source file:controllers.ReporteFechaController.java
public String construirStringFechaYHora(DateTime fechaYHora) { String fechaString = fechaYHora.getDayOfMonth() + "/" + fechaYHora.getMonthOfYear() + "/" + fechaYHora.getYear();/* w ww. j a v a 2 s . c o m*/ return fechaString; }
From source file:cron.DateTimes.java
License:Open Source License
public static DateTime lastOfMonth(DateTime t, int dayOfWeek) { DateTime friday = t.dayOfMonth().withMaximumValue().withDayOfWeek(dayOfWeek); if (friday.getMonthOfYear() != t.getMonthOfYear()) friday = friday.minusWeeks(1);/*w w w. j a v a 2 s. co m*/ return friday; }
From source file:cron.DateTimes.java
License:Open Source License
public static DateTime nthOfMonth(DateTime t, int dayOfWeek, int desiredNumber) { int month = t.getMonthOfYear(); t = t.withDayOfMonth(1).withDayOfWeek(dayOfWeek); if (t.getMonthOfYear() != month) t = t.plusWeeks(1);/*from w w w . ja va 2s . co m*/ int number = 1; while (number < desiredNumber && t.getMonthOfYear() == month) { number++; t = t.plusWeeks(1); } return t; }
From source file:cron.DayOfWeekField.java
License:Open Source License
public boolean matches(DateTime time) { if (unspecified) return true; final int dayOfWeek = time.getDayOfWeek(); int number = number(dayOfWeek); if (hasLast) { return last.contains(number) && time.getMonthOfYear() != time.plusWeeks(1).getMonthOfYear(); } else if (hasNth) { for (int possibleMatch : nth.get(number)) { DateTime midnight = time.withTimeAtStartOfDay(); DateTime first = midnight.withDayOfMonth(1).withDayOfWeek(dayOfWeek); if (first.getMonthOfYear() != time.getMonthOfYear()) first = first.plusWeeks(1); DateTime tomorrow = midnight.plusDays(1); int weekNumber = 1 + (int) ((tomorrow.getMillis() - first.getMillis()) / MILLISECONDS_PER_WEEK); if (possibleMatch == weekNumber) return true; }/* w w w . j a va 2s . c o m*/ } return contains(number); }
From source file:cron.DefaultCronExpression.java
License:Open Source License
@Override public boolean matches(DateTime t) { return second.contains(t.getSecondOfMinute()) && minute.contains(t.getMinuteOfHour()) && hour.contains(t.getHourOfDay()) && month.contains(t.getMonthOfYear()) && year.contains(t.getYear()) && dayOfWeek.matches(t) && dayOfMonth.matches(t); }
From source file:cron.Times.java
License:Open Source License
private void addDaysOfWeek(ImmutableSortedSet.Builder<DateTime> builder, DateTime base) { int month = base.getMonthOfYear(); Iterator<Integer> iterator = daysOfWeek.iterator(); base = base.withDayOfWeek(iterator.next()); if (base.getMonthOfYear() != month) base = base.plusWeeks(1);/*from w w w. j a va 2 s .co m*/ do { builder.add(base); base = base.plusWeeks(1); } while (base.getMonthOfYear() == month); }