List of usage examples for org.joda.time TimeOfDay toDateTimeToday
public DateTime toDateTimeToday(DateTimeZone zone)
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)); } }