📜  java代码示例中的日期格式

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

代码示例4
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");

try {
    LocalDate date = formatter.parse(text, LocalDate::from);
} catch (DateTimeParseException e) {
    // Thrown if text could not be parsed in the specified format
}