📜  LocalDateTime 到 XMLGregorianCalendar - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:24.795000             🧑  作者: Mango

代码示例1
LocalDateTime localDatetime = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");

String formattedDate = localDatetime.format(formatter);
XMLGregorianCalendar calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(formattedDate);