richardstartin commented on a change in pull request #8057:
URL: https://github.com/apache/pinot/pull/8057#discussion_r790605906



##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/utils/TimeUtils.java
##########
@@ -194,4 +198,20 @@ public static boolean isPeriodValid(String timeStr) {
       return false;
     }
   }
+
+  public static final String DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
+
+  public static Long convertDateTimeStringToMillis(String timeStr) {
+    Long millis = 0L;
+    SimpleDateFormat f = new SimpleDateFormat(DATE_TIME_FORMAT);
+    if (timeStr != null) {
+      try {
+        Date d = f.parse(timeStr);
+        millis = d.getTime();
+      } catch (ParseException e) {
+        return ERROR_FLAG;
+      }
+    }
+    return millis;

Review comment:
       Please use `java.time` instead - you can replace this with 
   ```java
   return timeStr == null ? 0L : Instant.parse(timeStr).toEpochMilli();
   ```
   
   This handles ISO 8601 timestamps automatically.




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