Skip to content

Commit

Permalink
[Improve][format][text] add dateTimeFormatter to parse ISO8601
Browse files Browse the repository at this point in the history
- cherrypick from apache#5974
  • Loading branch information
kangdw0x80 committed Feb 16, 2024
1 parent 3de3a99 commit 5bdf67f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class DateTimeUtils {
FORMATTER_MAP.put(
Formatter.YYYY_MM_DD_HH_MM_SS_NO_SPLIT,
DateTimeFormatter.ofPattern(Formatter.YYYY_MM_DD_HH_MM_SS_NO_SPLIT.value));
FORMATTER_MAP.put(
Formatter.YYYY_MM_DD_HH_MM_SS_ISO8601,
DateTimeFormatter.ofPattern(Formatter.YYYY_MM_DD_HH_MM_SS_ISO8601.value));
}

public static LocalDateTime parse(String dateTime, Formatter formatter) {
Expand All @@ -54,7 +57,8 @@ public enum Formatter {
YYYY_MM_DD_HH_MM_SS("yyyy-MM-dd HH:mm:ss"),
YYYY_MM_DD_HH_MM_SS_SPOT("yyyy.MM.dd HH:mm:ss"),
YYYY_MM_DD_HH_MM_SS_SLASH("yyyy/MM/dd HH:mm:ss"),
YYYY_MM_DD_HH_MM_SS_NO_SPLIT("yyyyMMddHHmmss");
YYYY_MM_DD_HH_MM_SS_NO_SPLIT("yyyyMMddHHmmss"),
YYYY_MM_DD_HH_MM_SS_ISO8601("yyyy-MM-dd'T'HH:mm:ss");

private final String value;

Expand Down

0 comments on commit 5bdf67f

Please sign in to comment.