LocalDateTime 时间戳转换

        long timestamp = Instant.now().toEpochMilli();
        long timestamp = LocalDateTime.now().toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
        System.out.println(timestamp);
        LocalDateTime inputTime= LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp),  ZoneOffset.ofHours(8));
        System.out.println(inputTime.toInstant(ZoneOffset.ofHours(8)).toEpochMilli());

 

posted @ 2021-11-18 15:19  将来的老大爷  阅读(1492)  评论(0编辑  收藏  举报

如果本页面列出的内容侵犯了您的权益,请告知。
知识共享许可协议
996.icu