DateUtils { public static Date rawtime2date(long rawtime) { return rawtime2date(rawtime, SHANGHAI_CAL); }  static long date2ms(Date date, Calendar calendar); static long date2ms(Date date); static Date ms2date(long ms); static Date ms2date(long ms, Calendar calendar); static long date2rawtime(Date date); static long date2rawtime(Date date, Calendar calendar); static Date rawtime2date(long rawtime); static Date rawtime2date(long rawtime, Calendar calendar); static String formatRfc822Date(Date date); static Date parseRfc822Date(String dateString); static long getDayOffset(java.sql.Date date); static java.sql.Date fromDayOffset(long offset); static Calendar LOCAL_CAL; static Calendar SHANGHAI_CAL; }
@Test public void testRawtime2date() throws IOException { Assert.assertEquals(DateUtils.rawtime2date(__0001_01_01_00_00_00), c1.getTime()); Assert.assertEquals(DateUtils.rawtime2date(__1927_12_31_23_54_07), c2.getTime()); Assert.assertEquals(DateUtils.rawtime2date(__1928_01_01_00_00_00), c3.getTime()); Assert.assertEquals(DateUtils.rawtime2date(__1970_01_01_00_00_00), c4.getTime()); Assert.assertEquals(DateUtils.rawtime2date(__1997_08_31_23_59_59), c5.getTime()); Assert.assertEquals(DateUtils.rawtime2date(__1997_09_01_00_59_59), c6.getTime()); Assert.assertEquals(DateUtils.rawtime2date(__2000_02_29_23_59_59), c7.getTime()); Assert.assertEquals(DateUtils.rawtime2date(__2014_08_26_15_22_46), c8.getTime()); Assert.assertEquals(DateUtils.rawtime2date(__2018_11_30_23_59_59), c9.getTime()); Assert.assertEquals(DateUtils.rawtime2date(__2499_01_01_00_00_00), c10.getTime()); Assert.assertEquals(DateUtils.rawtime2date(__1986_05_04_01_00_00), c11.getTime()); Assert.assertEquals(DateUtils.rawtime2date(__1986_05_04_02_00_00), c12.getTime()); }