Example usage for org.joda.time DateTime millisOfDay

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

Introduction

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

Prototype

public Property millisOfDay() 

Source Link

Document

Get the millis of day property which provides access to advanced functionality.

Usage

From source file:de.kuschku.libquassel.primitives.serializers.DateTimeSerializer.java

License:Open Source License

@NonNull
@Override/*from w  ww.java 2 s .  c o  m*/
public DateTime deserialize(@NonNull final ByteBuffer buffer) throws IOException {
    final long julianDay = IntSerializer.get().deserialize(buffer);
    final int millisSinceMidnight = IntSerializer.get().deserialize(buffer);

    final short zone = ByteSerializer.get().deserialize(buffer);

    if (millisSinceMidnight == 0x73007300 && julianDay == 0x50006100 || millisSinceMidnight == -1
            || julianDay == -1)
        return new DateTime(0);

    if ((zone & 0xfffffff0) > 0) {
        throw new IllegalArgumentException(
                "Deserialization of timezones except for local and UTC is not supported: " + zone);
    }

    DateTime time = new DateTime(DateTimeUtils.fromJulianDay(julianDay));
    time = time.millisOfDay().setCopy(millisSinceMidnight);
    if (zone == 0)
        time = time.withZone(DateTimeZone.getDefault());
    else
        time = time.withZone(DateTimeZone.UTC);

    return time;
}

From source file:de.kuschku.libquassel.primitives.serializers.TimeSerializer.java

License:Open Source License

@Override
public void serialize(@NonNull final ByteChannel channel, @NonNull final DateTime data) throws IOException {
    IntSerializer.get().serialize(channel, data.millisOfDay().get());
}

From source file:org.egov.infra.utils.DateUtils.java

License:Open Source License

public static DateTime endOfGivenDate(DateTime dateTime) {
    return dateTime.millisOfDay().withMaximumValue();
}

From source file:org.jpos.qi.components.DateRangeComponent.java

License:Open Source License

public DateRange getValue() {
    DateRange dr;//from w ww .ja v  a  2  s  . c  o m
    if (dateRanges != null && dateRanges.getValue() != null)
        dr = new DateRange(dateRanges.getValue().toString());
    else if (datePickerFrom.getValue() != null || datePickerTo.getValue() != null) {
        dr = new DateRange();
        if (datePickerFrom.getValue() != null) {
            DateTime dt = new DateTime(datePickerFrom.getValue());
            dr.setStart(dt.millisOfDay().withMinimumValue().toDate());
        }
        if (datePickerTo.getValue() != null) {
            DateTime dt = new DateTime(datePickerTo.getValue());
            dr.setEnd(dt.millisOfDay().withMaximumValue().toDate());
        }
    } else {
        dr = new DateRange();
        dr.setStart(null);
        dr.setEnd(null);
    }
    return dr;
}