Example usage for org.joda.time DateMidnight DateMidnight

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

Introduction

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

Prototype

public DateMidnight(int year, int monthOfYear, int dayOfMonth, Chronology chronology) 

Source Link

Document

Constructs an instance from datetime field values using the specified chronology.

Usage

From source file:net.sourceforge.fenixedu.util.HourMinuteSecond.java

License:Open Source License

/**
 * Converts this object to a DateMidnight.
 * /*  w  w  w  .  j av a2 s.c o  m*/
 * @param zone
 *            the zone to get the DateMidnight in, null means default
 * @return the DateMidnight instance
 */
public DateMidnight toDateMidnight(DateTimeZone zone) {
    Chronology chrono = getChronology().withZone(zone);
    return new DateMidnight(0, 0, 0, chrono);
}

From source file:org.jadira.usertype.dateandtime.joda.AbstractMultiColumnDateMidnight.java

License:Apache License

@Override
protected DateMidnight fromConvertedColumns(Object[] convertedColumns) {

    LocalDate datePart = (LocalDate) convertedColumns[0];
    DateTimeZoneWithOffset offset = (DateTimeZoneWithOffset) convertedColumns[1];

    final DateMidnight result;

    if (datePart == null) {
        result = null;// w  ww  .j  ava  2  s  .  c  o m
    } else {
        result = new DateMidnight(datePart.getYear(), datePart.getMonthOfYear(), datePart.getDayOfMonth(),
                offset.getStandardDateTimeZone());
    }

    // Handling DST rollover
    if (datePart != null && offset.getOffsetDateTimeZone() != null && offset.getStandardDateTimeZone()
            .getOffset(result) > offset.getOffsetDateTimeZone().getOffset(result)) {
        return new DateMidnight(datePart.getYear(), datePart.getMonthOfYear(), datePart.getDayOfMonth(),
                offset.getOffsetDateTimeZone());
    }

    return result;
}