Java Code Examples for org.joda.time.DateTime#toDateMidnight()

The following examples show how to use org.joda.time.DateTime#toDateMidnight() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpaceOccupationEventBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String getPresentationInterval() {
    final DateTime start = interval.getStart();
    final DateTime end = interval.getEnd();
    final DateMidnight dateMidnight = start.toDateMidnight();
    if (dateMidnight.equals(end.toDateMidnight())) {
        return String.format("%s : %s as %s", dateMidnight.toString(DATE_FORMAT), getTime(start), getTime(end));
    }
    return interval.toString();
}
 
Example 2
Source File: SpaceOccupationEventBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public DateMidnight getDateDay() {
    final DateTime start = interval.getStart();
    final DateTime end = interval.getEnd();
    final DateMidnight dateMidnight = start.toDateMidnight();
    if (dateMidnight.equals(end.toDateMidnight())) {
        return dateMidnight;
    }
    return null;
}
 
Example 3
Source File: InstallmentWithMonthlyPenalty.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected int getNumberOfMonthsToChargePenalty(DateTime when) {
    final Period period = new Period(getWhenStartToApplyPenalty().withDayOfMonth(1).toDateMidnight(), when.toDateMidnight());
    final int numberOfMonths = (period.getYears() * 12) + (period.getMonths() + 1);
    if (getMaxMonthsToApplyPenalty() == null) {
        return numberOfMonths;
    } else {
        return numberOfMonths < getMaxMonthsToApplyPenalty() ? numberOfMonths : getMaxMonthsToApplyPenalty();
    }
}
 
Example 4
Source File: InstallmentForFirstTimeStudents.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
private int getNumberOfMonthsToChargePenalty(final Event event, final DateTime when) {
    final Period period = new Period(getWhenStartToApplyPenalty(event, when), when.toDateMidnight());
    final int numberOfMonths = (period.getYears() * 12) + (period.getMonths() + 1);
    if (getMaxMonthsToApplyPenalty() == null) {
        return numberOfMonths;
    } else {
        return numberOfMonths < getMaxMonthsToApplyPenalty() ? numberOfMonths : getMaxMonthsToApplyPenalty();
    }
}
 
Example 5
Source File: JodaDateMidnightConverter.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
Object parse(final String data) {
  try {
    final DateTimeFormatter parseFormat = DateTimeFormat.forPattern(ISO_FORMAT);
    final DateTime date = parseFormat.withZone(DateTimeZone.UTC).parseDateTime(data);
    final DateMidnight dateMidnight = date.toDateMidnight();
    return dateMidnight;
  } catch (final Exception ex) {
    log.error("Can't parse DateMidnight: " + data);
    return new DateMidnight();
  }
}
 
Example 6
Source File: JodaTimeConverters.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public org.joda.time.DateMidnight convert(DateTime source) {
	return source.toDateMidnight();
}
 
Example 7
Source File: JodaTimeConverters.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public org.joda.time.DateMidnight convert(DateTime source) {
	return source.toDateMidnight();
}
 
Example 8
Source File: JodaTimeConverters.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public org.joda.time.DateMidnight convert(DateTime source) {
	return source.toDateMidnight();
}
 
Example 9
Source File: JodaTimeConverters.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public org.joda.time.DateMidnight convert(DateTime source) {
	return source.toDateMidnight();
}