@Test public void testConvertToTime01() { DateTime date = new DateTime(2012, 9, 3, 23, 7, 11, 100); Time time = DateConvertUtils.convertToTime(date.toDate()); DateTime result = new DateTime(time.getTime()); assertThat(result.getYear(), is(1970)); assertThat(result.getMonthOfYear(), is(1)); assertThat(result.getDayOfMonth(), is(1)); assertThat(result.getHourOfDay(), is(23)); assertThat(result.getMinuteOfHour(), is(7)); assertThat(result.getSecondOfMinute(), is(11)); assertThat(result.getMillisOfSecond(), is(100)); }
public static Time convertToTime(java.util.Date date) { assertArgs(date); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.YEAR, DEFAULT_YEAR); cal.set(Calendar.MONTH, 0); cal.set(Calendar.DAY_OF_MONTH, 1); Time time = new Time(cal.getTimeInMillis()); return time; }
DateConvertUtils { public static Time convertToTime(java.util.Date date) { assertArgs(date); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.YEAR, DEFAULT_YEAR); cal.set(Calendar.MONTH, 0); cal.set(Calendar.DAY_OF_MONTH, 1); Time time = new Time(cal.getTimeInMillis()); return time; } }
DateConvertUtils { public static Time convertToTime(java.util.Date date) { assertArgs(date); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.YEAR, DEFAULT_YEAR); cal.set(Calendar.MONTH, 0); cal.set(Calendar.DAY_OF_MONTH, 1); Time time = new Time(cal.getTimeInMillis()); return time; } private  DateConvertUtils(); }
DateConvertUtils { public static Time convertToTime(java.util.Date date) { assertArgs(date); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.YEAR, DEFAULT_YEAR); cal.set(Calendar.MONTH, 0); cal.set(Calendar.DAY_OF_MONTH, 1); Time time = new Time(cal.getTimeInMillis()); return time; } private  DateConvertUtils(); static Timestamp convertToTimestamp(java.util.Date date); static java.sql.Date convertToSqlDate(java.util.Date date); static Time convertToTime(java.util.Date date); }
DateConvertUtils { public static Time convertToTime(java.util.Date date) { assertArgs(date); Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.YEAR, DEFAULT_YEAR); cal.set(Calendar.MONTH, 0); cal.set(Calendar.DAY_OF_MONTH, 1); Time time = new Time(cal.getTimeInMillis()); return time; } private  DateConvertUtils(); static Timestamp convertToTimestamp(java.util.Date date); static java.sql.Date convertToSqlDate(java.util.Date date); static Time convertToTime(java.util.Date date);  }