fritzb commented on a change in pull request #7552:
URL: https://github.com/apache/pinot/pull/7552#discussion_r725745887



##########
File path: 
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/DateTimeFunctions.java
##########
@@ -256,6 +257,17 @@ public static String toDateTime(long millis, String 
pattern) {
     return DateTimePatternHandler.parseEpochMillisToDateTimeString(millis, 
pattern);
   }
 
+  /**
+   * Converts epoch millis to DateTime string represented by pattern
+   * and the time zone id.
+   */
+  @ScalarFunction
+  public static String toDateTime(long millis, String pattern, String 
timezoneId) {
+    return DateTimeFormat
+            .forPattern(pattern)
+            .withZone(DateTimeZone.forID(timezoneId)).print(millis);
+  }
+

Review comment:
       `fromDateTime()` has TimeZone support to convert a String with timeZone. 
This function return value is epoch millis, which implicitly in UTC timezone. 
Here is an example: `fromDateTime(dateTime, 'EEE MMM dd HH:mm:ss ZZZ yyyy')` 
will convert `"Mon Aug 24 12:36:46 America/Los_Angeles 2009"` into 
`1251142606000L`.
   
   I'm thinking `timezoneId` as the third argument is not needed. Let me know 
what you think ?




-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to