@Test
    public void dateToStr() throws Exception {

        long s1 = 1501127802975l; // 2017-07-27 11:56:42:975 +8
        long s2 = 1501127835658l; // 2017-07-27 11:57:15:658 +8
        TimeZone timeZone = TimeZone.getDefault();

        Date date0 = new Date(0 - timeZone.getOffset(0));
        Date date1 = new Date(s1 - timeZone.getOffset(s1));
        Date date2 = new Date(s2 - timeZone.getOffset(s2));

        Assert.assertEquals(DateUtils.dateToStr(date0), "1970-01-01 00:00:00");
        Assert.assertEquals(DateUtils.dateToStr(date1), "2017-07-27 03:56:42");
        Assert.assertEquals(DateUtils.dateToStr(date2), "2017-07-27 03:57:15");
    }
@author <a href="mailto:zhanggeng.zg@antfin.com">GengZhang</a>
core/common/src/test/java/com/alipay/sofa/rpc/common/utils/DateUtilsTest.java