2021
03-05
03-05
Java8中LocalDateTime与时间戳timestamp的互相转换
Java8LocalDateTime与timestamp转换将timestamp转为LocalDateTimepublicLocalDateTimetimestamToDatetime(longtimestamp){Instantinstant=Instant.ofEpochMilli(timestamp);returnLocalDateTime.ofInstant(instant,ZoneId.systemDefault());}将LocalDataTime转为timestamppubliclongdatatimeToTimestamp(LocalDateTimeldt){longtimestamp=ldt.toInstant(ZoneOffset.of("+8")).toEpochMilli();returntimes...
继续阅读 >