/** * TODO handling of SQL timezone * * @param input * @return */ private java.sql.Time toSqlTime(Object input) { if (input instanceof java.sql.Time) { return (java.sql.Time) input; } java.sql.Time value = null; if (input instanceof java.util.Date) { java.util.Date date = (java.util.Date) input; value = new java.sql.Time(date.getTime()); } else if (input instanceof Temporal) { Temporal timeInstant = (Temporal) input; value = new java.sql.Time(timeInstant.getTimeInMilliseconds()); } else { String s = input.toString(); Time timeInstant = parseTime(s); value = toSqlTime(timeInstant); } return value; }
/** * TODO handling of SQL timezone * * @param input * @return */ protected Timestamp toSqlTimestamp(Object input) { if (input instanceof Timestamp) { return (Timestamp) input; } Timestamp value = null; if (input instanceof java.util.Date) { java.util.Date date = (java.util.Date) input; value = new Timestamp(date.getTime()); } else if (input instanceof Temporal) { Temporal timeInstant = (Temporal) input; value = new Timestamp(timeInstant.getTimeInMilliseconds()); } else { String s = input.toString(); DateTime timeInstant = parseDateTime(s); value = toSqlTimestamp(timeInstant); } return value; }