Example usage for org.joda.time DateTime getMonthOfYear

List of usage examples for org.joda.time DateTime getMonthOfYear

Introduction

In this page you can find the example usage for org.joda.time DateTime getMonthOfYear.

Prototype

public int getMonthOfYear() 

Source Link

Document

Get the month of year field value.

Usage

From source file:kr.debop4j.timeperiod.TimeCalendar.java

License:Apache License

@Override
public int getMonthOfYear(DateTime time) {
    return time.getMonthOfYear();
}

From source file:kr.debop4j.timeperiod.timerange.HalfyearRange.java

License:Apache License

/**
 * Instantiates a new Halfyear range.//  w  ww  .j  a v  a 2s  . c o m
 *
 * @param moment   the moment
 * @param calendar the calendar
 */
public HalfyearRange(DateTime moment, ITimeCalendar calendar) {
    this(Times.getYearOf(calendar.getYear(moment), calendar.getMonthOfYear(moment)),
            Times.getHalfyearOfMonth(moment.getMonthOfYear()), calendar);
}

From source file:kr.debop4j.timeperiod.timerange.MonthTimeRange.java

License:Apache License

/**  (Month)? ? ? ({@link DayRange}) ? . */
public List<DayRange> getDays() {
    DateTime startMonth = Times.startTimeOfMonth(getStart());
    List<DayRange> days = Lists.newArrayListWithCapacity(monthCount * TimeSpec.MaxDaysPerMonth);

    for (int m = 0; m < monthCount; m++) {
        DateTime monthStart = startMonth.plusMonths(m);
        int daysOfMonth = Times.getDaysInMonth(monthStart.getYear(), monthStart.getMonthOfYear());
        for (int d = 0; d < daysOfMonth; d++) {
            days.add(new DayRange(monthStart.plusDays(d), getTimeCalendar()));
        }//from   ww w  .  j  a va  2s  .co  m
    }
    return days;
}

From source file:kr.debop4j.timeperiod.timerange.QuarterRange.java

License:Apache License

/**
 * Instantiates a new Quarter range.//from   w  w w .ja  v a2s  .  co m
 *
 * @param moment   the moment
 * @param calendar the calendar
 */
public QuarterRange(DateTime moment, ITimeCalendar calendar) {
    this(Times.getYearOf(calendar.getYear(moment), calendar.getMonthOfYear(moment)),
            Times.getQuarterOfMonth(moment.getMonthOfYear()), calendar);
}

From source file:kr.debop4j.timeperiod.tools.Times.java

License:Apache License

/**
 * Gets year of.// w ww.ja va 2  s  .  c  om
 *
 * @param moment the moment
 * @return the year of
 */
public static int getYearOf(DateTime moment) {
    return getYearOf(moment.getYear(), moment.getMonthOfYear());
}

From source file:kr.debop4j.timeperiod.tools.Times.java

License:Apache License

/**
 * ? ?? (halfyear)   true  false .//from  w w  w.j a  va 2 s  . c o  m
 *
 * @param left  the left
 * @param right the right
 * @return the boolean
 */
public static boolean isSameHalfyear(DateTime left, DateTime right) {
    return isSameYear(left, right)
            && getHalfyearOfMonth(left.getMonthOfYear()) == getHalfyearOfMonth(right.getMonthOfYear());
}

From source file:kr.debop4j.timeperiod.tools.Times.java

License:Apache License

/**
 * ? ?? (quarter)   true  false .//  w  w  w. ja v a2 s .c o m
 *
 * @param left  the left
 * @param right the right
 * @return the boolean
 */
public static boolean isSameQuarter(DateTime left, DateTime right) {
    return isSameYear(left, right)
            && getQuarterOfMonth(left.getMonthOfYear()) == getQuarterOfMonth(right.getMonthOfYear());
}

From source file:kr.debop4j.timeperiod.tools.Times.java

License:Apache License

/**
 * ? ?? (Month)   true  false ./*from   w  w w.ja v  a2  s .  c o  m*/
 *
 * @param left  the left
 * @param right the right
 * @return the boolean
 */
public static boolean isSameMonth(DateTime left, DateTime right) {
    return isSameYear(left, right) && left.getMonthOfYear() == right.getMonthOfYear();
}

From source file:kr.debop4j.timeperiod.tools.Times.java

License:Apache License

/**  ?? ? ? ? */
public static DateTime currentHalfyear() {
    DateTime now = now();
    Halfyear halfyear = getHalfyearOfMonth(now.getMonthOfYear());
    int month = getMonthsOfHalfyear(halfyear)[0];

    return asDate(now.getYear(), month, 1);
}

From source file:kr.debop4j.timeperiod.tools.Times.java

License:Apache License

/**  ?? ? ? ? */
public static DateTime currentQuarter() {
    DateTime now = now();
    Quarter quarter = getQuarterOfMonth(now.getMonthOfYear());
    int month = getMonthsOfQuarter(quarter)[0];

    return asDate(now.getYear(), month, 1);
}