Example usage for org.joda.time MonthDay MonthDay

List of usage examples for org.joda.time MonthDay MonthDay

Introduction

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

Prototype

public MonthDay(Object instant) 

Source Link

Document

Constructs a MonthDay from an Object that represents some form of time.

Usage

From source file:org.apereo.portal.events.aggr.dao.jpa.QuarterDetailImpl.java

License:Apache License

@Override
public DateMidnight getStartDateMidnight(ReadableInstant instant) {
    final MonthDay instantMonthDay = new MonthDay(instant);

    //If the quarter wraps a year boundary AND
    //   the instant MonthDay is before the start AND
    //   the end is after the instant MonthDay
    // then shift the start year back by one to deal with the year boundary
    if (this.end.isBefore(this.start) && instantMonthDay.isBefore(this.start)
            && this.end.isAfter(instantMonthDay)) {
        return this.start.toDateTime(new DateTime(instant).minusYears(1)).toDateMidnight();
    }/*from   www. j ava 2s  . co m*/

    return this.start.toDateTime(instant).toDateMidnight();
}

From source file:org.apereo.portal.events.aggr.dao.jpa.QuarterDetailImpl.java

License:Apache License

@Override
public DateMidnight getEndDateMidnight(ReadableInstant instant) {
    final MonthDay instantMonthDay = new MonthDay(instant);

    //If the quarter wraps a year boundary AND
    //   the end is NOT after the instant MonthDay AND
    //   the instant MonthDay is NOT before the start
    // then shift the end year forward by one to deal with the year boundary
    if (this.end.isBefore(this.start) && !this.end.isAfter(instantMonthDay)
            && !instantMonthDay.isBefore(this.start)) {
        return this.end.toDateTime(new DateTime(instant).plusYears(1)).toDateMidnight();
    }//w w w . j a  v a 2 s .  c o m

    return this.end.toDateTime(instant).toDateMidnight();
}

From source file:org.jasig.portal.events.aggr.dao.jpa.QuarterDetailImpl.java

License:Apache License

@Override
public DateMidnight getEndDateMidnight(ReadableInstant instant) {
    final MonthDay instantMonthDay = new MonthDay(instant);

    //If the quarter wraps a year boundary AND
    //   the end is NOT after the instant MonthDay AND 
    //   the instant MonthDay is NOT before the start
    // then shift the end year forward by one to deal with the year boundary
    if (this.end.isBefore(this.start) && !this.end.isAfter(instantMonthDay)
            && !instantMonthDay.isBefore(this.start)) {
        return this.end.toDateTime(new DateTime(instant).plusYears(1)).toDateMidnight();
    }// w  w  w  . jav a  2  s .  c  o  m

    return this.end.toDateTime(instant).toDateMidnight();
}