From 5bdf67f6675d05715ad80ed7ee9726d613b7b454 Mon Sep 17 00:00:00 2001 From: Dongwoo Kang Date: Fri, 16 Feb 2024 16:52:15 +0900 Subject: [PATCH] [Improve][format][text] add dateTimeFormatter to parse ISO8601 - cherrypick from https://github.com/apache/seatunnel/pull/5974 --- .../org/apache/seatunnel/common/utils/DateTimeUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/DateTimeUtils.java b/seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/DateTimeUtils.java index 5801654cf51..bf81ed626c7 100644 --- a/seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/DateTimeUtils.java +++ b/seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/DateTimeUtils.java @@ -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) { @@ -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;