【原创】 JAVA UTC时间转化为本地时间LocalDateTime
public LocalDateTime convertUTCToLocalTime(String timeStamp) { Long timeLong = Long.parseLong(timeStamp) * 1000L; Date timeDate = new java.util.Date(timeLong); String date = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(timeDate); DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); LocalDateTime ldt = LocalDateTime.parse(date, df); return ldt; }
随笔仅为记录知识点用,多为转载及补充修正,部分为自己原创。

浙公网安备 33010602011771号