Example usage for org.joda.time TimeOfDay toDateTimeToday

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

Introduction

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

Prototype

public DateTime toDateTimeToday(DateTimeZone zone) 

Source Link

Document

Converts this partial to a full datetime using the specified time zone setting the time fields from this instance and the date fields from the current time.

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  ww. j  av  a2 s .c  om
        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:com.moss.jodapersist.StringTimeOfDayUserType.java

License:Open Source License

public void nullSafeSet(PreparedStatement statement, Object value, int index)
        throws HibernateException, SQLException {

    if (value == null) {
        statement.setString(index, null);
    } else {// w  w w .  ja v  a 2  s.  c om
        TimeOfDay tmd = (TimeOfDay) value;
        long millisInZone = tmd.toDateTimeToday(DateTimeZone.forTimeZone(timeZone)).getMillis();
        Timestamp timestamp = new Timestamp(millisInZone);

        statement.setString(index,
                formatter.format(tmd.toDateTimeToday(DateTimeZone.forTimeZone(super.timeZone)).toDate()));
    }
}

From source file:com.moss.jodapersist.TimestampTimeOfDayUserType.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 ww  w.ja v a 2 s  .  c  o m
        final TimeOfDay tmd = (TimeOfDay) value;
        final long millisInZone = tmd.toDateTimeToday(zone).getMillis();
        final Timestamp timestamp = new Timestamp(millisInZone);

        statement.setTimestamp(index, timestamp, new GregorianCalendar(timeZone));
    }
}