Example usage for org.joda.time TimeOfDay getSecondOfMinute

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

Introduction

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

Prototype

public int getSecondOfMinute() 

Source Link

Document

Get the second of minute field value.

Usage

From source file:com.moss.jodapersist.AnsiTimeOfDay.java

License:Open Source License

public void nullSafeSet(PreparedStatement statement, Object value, int index)
        throws HibernateException, SQLException {
    if (value == null) {
        statement.setTimestamp(index, null);
    } else {/*from w w  w. jav  a2 s  .  c o  m*/
        TimeOfDay tmd = (TimeOfDay) value;

        long millisInZone = tmd.toDateTimeToday(DateTimeZone.forTimeZone(timeZone)).getMillis();
        Timestamp timestamp = new Timestamp(millisInZone);

        Time time = new Time(tmd.getHourOfDay(), tmd.getMinuteOfHour(), tmd.getSecondOfMinute());

        statement.setTime(index, time);
    }
}

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);
        }/*w  ww . j  a v  a2s .c o  m*/
        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;/*from   ww w .ja v  a  2  s.c om*/
}

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;
}