Example usage for org.joda.time TimeOfDay getMillisOfSecond

List of usage examples for org.joda.time TimeOfDay getMillisOfSecond

Introduction

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

Prototype

public int getMillisOfSecond() 

Source Link

Document

Get the millis of second field value.

Usage

From source file:org.jadira.usertype.dateandtime.joda.columnmapper.StringColumnTimeOfDayMapper.java

License:Apache License

@Override
public String toNonNullValue(TimeOfDay value) {

    if (value.getMillisOfSecond() == 0) {
        if (value.getSecondOfMinute() == 0) {
            return Formatter.LOCAL_TIME_NOSECONDS_PRINTER.print(value);
        }/*from  ww  w. j a v  a  2 s .  com*/
        return Formatter.LOCAL_TIME_NOMILLIS_PRINTER.print(value);
    } else {
        return value.toString().substring(1);
    }
}

From source file:org.jadira.usertype.dateandtime.joda.columnmapper.TimeColumnTimeOfDayMapper.java

License:Apache License

@Override
public Time toNonNullValue(TimeOfDay value) {

    DateTime zonedValue = new LocalDateTime(1970, 1, 1, value.getHourOfDay(), value.getMinuteOfHour(),
            value.getSecondOfMinute(), value.getMillisOfSecond(), value.getChronology()).toDateTime();

    final Time time = new Time(zonedValue.getMillis());
    return time;/*w w w .jav a  2s  .  co  m*/
}

From source file:org.jadira.usertype.dateandtime.joda.columnmapper.TimestampColumnTimeOfDayMapper.java

License:Apache License

@Override
public Timestamp toNonNullValue(TimeOfDay value) {

    DateTime zonedValue = new LocalDateTime(1970, 1, 1, value.getHourOfDay(), value.getMinuteOfHour(),
            value.getSecondOfMinute(), value.getMillisOfSecond(), value.getChronology()).toDateTime();

    final Timestamp timestamp = new Timestamp(zonedValue.getMillis());
    return timestamp;
}