Java8 LocalDateTime获取时间戳(毫秒/秒)

//获取秒数
Long second = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"));
//获取毫秒数
Long milliSecond = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli();

猜你喜欢

转载自blog.csdn.net/u014044812/article/details/79231738