@Test public void testFormateDateTime() { assertEquals("2011-11-25 13:12:01", DateUtil.formateDateTime(new Date(1322197921282L))); Date currentTime = DateUtil.parseDateTime("2009-01-01 00:00:00", null); System.out.println(currentTime + ", " + (currentTime.getTime() / 1000)); currentTime = DateUtil.parseDateTime("2009-06-01 00:00:00", null); System.out.println(currentTime + ", " + (currentTime.getTime() / 1000)); currentTime = DateUtil.parseDateTime("2010-01-01 00:00:00", null); System.out.println(currentTime + ", " + (currentTime.getTime() / 1000)); currentTime = DateUtil.parseDateTime("2011-01-01 00:00:00", null); System.out.println(currentTime + ", " + (currentTime.getTime() / 1000)); currentTime = DateUtil.parseDateTime("2011-06-01 00:00:00", null); System.out.println(currentTime + ", " + (currentTime.getTime() / 1000)); currentTime = DateUtil.parseDateTime("2013-01-01 00:00:00", null); System.out.println(currentTime + ", " + (currentTime.getTime() / 1000)); currentTime = DateUtil.parseDateTime("2015-01-01 00:00:00", null); System.out.println(currentTime + ", " + (currentTime.getTime() / 1000)); }
public static String formateDateTime(Date date){ return dateTimeSdf.get().format(date); }
DateUtil { public static String formateDateTime(Date date){ return dateTimeSdf.get().format(date); } }
DateUtil { public static String formateDateTime(Date date){ return dateTimeSdf.get().format(date); }  }
DateUtil { public static String formateDateTime(Date date){ return dateTimeSdf.get().format(date); }  static String getYearMonth(Date date); static String formateYearMonthDay(Date date); static Date parseYearMonthDay(String timeStr, Date defaultValue); static String formateDateTime(Date date); static Date parseDateTime(String timeStr, Date defaultValue); static final int getCurrentHour(); static final int getLastHour(); static final int getNextHour(); static Date getFirstDayOfCurMonth(); static Date getFirstDayInMonth(Date date); static Date getFirstDayInMonth(int month); static boolean isCurrentMonth(Date date); }
DateUtil { public static String formateDateTime(Date date){ return dateTimeSdf.get().format(date); }  static String getYearMonth(Date date); static String formateYearMonthDay(Date date); static Date parseYearMonthDay(String timeStr, Date defaultValue); static String formateDateTime(Date date); static Date parseDateTime(String timeStr, Date defaultValue); static final int getCurrentHour(); static final int getLastHour(); static final int getNextHour(); static Date getFirstDayOfCurMonth(); static Date getFirstDayInMonth(Date date); static Date getFirstDayInMonth(int month); static boolean isCurrentMonth(Date date);  }