LocalDateTime a = new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
System.out.println(a);
Date b = Date.from(a.atZone(ZoneId.systemDefault()).toInstant());
System.out.println(b);
long c = a.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
long d = b.getTime();
System.out.println(c);
System.out.println(d);
LocalDateTime 和 Date 相互转换,LocalDateTime获取时间戳
猜你喜欢
转载自blog.csdn.net/u013845177/article/details/88886821
今日推荐
周排行