@Test public void Stringからのconvertテスト() throws Exception { SimpleDateFormat sdf = new SimpleDateFormat(); sdf.applyPattern("yyyy/MM/dd HH:mm:ss.SSS"); String ymdhmss = "2011/11/11 13:45:56.789"; assertEquals(sdf.parse(ymdhmss), new SqlDateConverter().convert(ymdhmss)); sdf.applyPattern("yyyy/MM/dd"); String ymdhms = "2011/11/11 13:45:56"; assertEquals(sdf.parse(ymdhms), new SqlDateConverter().convert(ymdhms)); String ymdhm = "2011/11/11 13:45"; assertEquals(sdf.parse(ymdhm), new SqlDateConverter().convert(ymdhm)); String ymdh = "2011/11/11 13"; assertEquals(sdf.parse(ymdh), new SqlDateConverter().convert(ymdh)); String ymd = "2011/11/11"; assertEquals(sdf.parse(ymd), new SqlDateConverter().convert(ymd)); sdf.applyPattern("yyyy-MM-dd HH:mm:ss.SSS"); String hymdhmss = "2011-11-11 13:45:56.789"; assertEquals(sdf.parse(hymdhmss), new SqlDateConverter().convert(hymdhmss)); sdf.applyPattern("yyyy-MM-dd"); String hymdhms = "2011-11-11 13:45:56"; assertEquals(sdf.parse(hymdhms), new SqlDateConverter().convert(hymdhms)); String hymdhm = "2011-11-11 13:45"; assertEquals(sdf.parse(hymdhm), new SqlDateConverter().convert(hymdhm)); String hymdh = "2011-11-11 13"; assertEquals(sdf.parse(hymdh), new SqlDateConverter().convert(hymdh)); String hymd = "2011-11-11"; assertEquals(sdf.parse(hymd), new SqlDateConverter().convert(hymd)); }
public Date convert(Timestamp t) { return new java.sql.Date(t.getTime()); }
SqlDateConverter implements TypeConverter<Date> { public Date convert(Timestamp t) { return new java.sql.Date(t.getTime()); } }
SqlDateConverter implements TypeConverter<Date> { public Date convert(Timestamp t) { return new java.sql.Date(t.getTime()); } SqlDateConverter(); }
SqlDateConverter implements TypeConverter<Date> { public Date convert(Timestamp t) { return new java.sql.Date(t.getTime()); } SqlDateConverter(); Date convert(Timestamp t); Date convert(java.util.Date d); Date convert(String v); }
SqlDateConverter implements TypeConverter<Date> { public Date convert(Timestamp t) { return new java.sql.Date(t.getTime()); } SqlDateConverter(); Date convert(Timestamp t); Date convert(java.util.Date d); Date convert(String v);  }