learning java Date类

        var d1 = new Date();
        var d2 = new Date(System.currentTimeMillis() + 1000);
        System.out.println(d1);
        System.out.println(d2);

        System.out.println(d1.compareTo(d2));
        System.out.println(d1.before(d2));

        System.out.println(d1.getTime()/1000);

 output:

Thu Jul 25 17:07:34 CST 2019
Thu Jul 25 17:07:35 CST 2019
-1
true
1564045654

 

posted @ 2019-07-25 17:10  嵌入式实操  阅读(77)  评论(0编辑  收藏  举报