diff --git a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/temporal/LocalTimeFunction.java b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/temporal/LocalTimeFunction.java index 0a998a7a48..dd79a64cb3 100644 --- a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/temporal/LocalTimeFunction.java +++ b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/temporal/LocalTimeFunction.java @@ -28,6 +28,7 @@ import java.time.LocalTime; import java.time.ZoneId; +import java.time.format.DateTimeFormatter; /** * LocalTimeFunction -> localTime([timeZoneStr]) @@ -55,11 +56,12 @@ public LocalTimeFunction(Function expr) { @Override public Object parse(SourceData sourceData, int rowIndex, Context context) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); if (stringParser != null) { String zoneString = OperatorTools.parseString(stringParser.parse(sourceData, rowIndex, context)); - return LocalTime.now(ZoneId.of(zoneString)).withNano(0); + return LocalTime.now(ZoneId.of(zoneString)).withNano(0).format(formatter); } else { - return LocalTime.now(ZoneId.systemDefault()).withNano(0); + return LocalTime.now(ZoneId.systemDefault()).withNano(0).format(formatter); } } }