Java API构造BasicDateVector / BasicTimeVector需要传入int列表,如何将日期或时间转换为int类型?

请先 登录 后评论

1 个回答

Juntao Wang

示例如下:

DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HHmmssSSS");

Utils.countDays(LocalDate.parse(currentDate, dateFormatter))
Utils.countMilliseconds(LocalTime.parse(String.format("%09d", Integer.parseInt(localCurrentTime)), timeFormatter))
请先 登录 后评论