leonardBang commented on code in PR #3449:
URL: https://github.com/apache/flink-cdc/pull/3449#discussion_r1699834398


##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/functions/SystemFunctionUtils.java:
##########
@@ -64,22 +64,23 @@ public static TimestampData currentTimestamp(long 
epochTime, String timezone) {
     }
 
     public static LocalZonedTimestampData now(long epochTime, String timezone) 
{
-        return LocalZonedTimestampData.fromEpochMillis(epochTime);
+        return LocalZonedTimestampData.fromEpochMillis(
+                epochTime + 
TimeZone.getTimeZone(timezone).getOffset(epochTime));

Review Comment:
   `LocalZonedTimestampData` is not related to TimeZone IIUC



##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/functions/SystemFunctionUtils.java:
##########
@@ -64,22 +64,23 @@ public static TimestampData currentTimestamp(long 
epochTime, String timezone) {
     }
 
     public static LocalZonedTimestampData now(long epochTime, String timezone) 
{
-        return LocalZonedTimestampData.fromEpochMillis(epochTime);
+        return LocalZonedTimestampData.fromEpochMillis(
+                epochTime + 
TimeZone.getTimeZone(timezone).getOffset(epochTime));
     }
 
     public static String dateFormat(LocalZonedTimestampData timestamp, String 
format) {
-        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
-        return dateFormat.format(new Date(timestamp.getEpochMillisecond()));
+        return DateTimeUtils.formatTimestampMillis(
+                timestamp.getEpochMillisecond(), format, 
TimeZone.getTimeZone("GMT"));

Review Comment:
   Could you use “UTC” instead of "GMT" as later is deprecated?



##########
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/functions/SystemFunctionUtils.java:
##########
@@ -64,22 +64,23 @@ public static TimestampData currentTimestamp(long 
epochTime, String timezone) {
     }
 
     public static LocalZonedTimestampData now(long epochTime, String timezone) 
{
-        return LocalZonedTimestampData.fromEpochMillis(epochTime);
+        return LocalZonedTimestampData.fromEpochMillis(
+                epochTime + 
TimeZone.getTimeZone(timezone).getOffset(epochTime));
     }
 
     public static String dateFormat(LocalZonedTimestampData timestamp, String 
format) {
-        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
-        return dateFormat.format(new Date(timestamp.getEpochMillisecond()));
+        return DateTimeUtils.formatTimestampMillis(
+                timestamp.getEpochMillisecond(), format, 
TimeZone.getTimeZone("GMT"));
     }
 
     public static String dateFormat(TimestampData timestamp, String format) {
-        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
-        return dateFormat.format(new Date(timestamp.getMillisecond()));
+        return DateTimeUtils.formatTimestampMillis(
+                timestamp.getMillisecond(), format, 
TimeZone.getTimeZone("GMT"));
     }
 
     public static String dateFormat(ZonedTimestampData timestamp, String 
format) {
-        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
-        return dateFormat.format(new Date(timestamp.getMillisecond()));
+        return DateTimeUtils.formatTimestampMillis(
+                timestamp.getMillisecond(), format, 
TimeZone.getTimeZone("GMT"));
     }

Review Comment:
   plz use UTC



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to