Example usage for org.joda.time TimeOfDay getHourOfDay

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

Introduction

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

Prototype

public int getHourOfDay() 

Source Link

Document

Get the hour of day (0-23) 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 .  j  av  a2s  .  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.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  ww .  ja v  a 2s . com
}

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