标签:mes color span now() str epo eof ant off
//时间转字符串格式化 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"); String dateTime = LocalDateTime.now(ZoneOffset.of("+8")).format(formatter); //字符串转时间 String dateTimeStr = "2018-07-28 14:11:15"; DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); LocalDateTime dateTime = LocalDateTime.parse(dateTimeStr, df);
//获取秒数 Long second = LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")); //获取毫秒数 Long milliSecond = LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli();
标签:mes color span now() str epo eof ant off
原文地址:https://www.cnblogs.com/bors/p/LocalDateTime.html