You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "tindzk (via GitHub)" <gi...@apache.org> on 2023/04/03 07:56:01 UTC

[GitHub] [calcite] tindzk commented on a diff in pull request #3134: [CALCITE-5619] Add support for TO_CHAR

tindzk commented on code in PR #3134:
URL: https://github.com/apache/calcite/pull/3134#discussion_r1155605322


##########
core/src/main/java/org/apache/calcite/util/format/FormatElementEnum.java:
##########
@@ -165,10 +173,17 @@ public enum FormatElementEnum implements FormatElement {
       return String.format(Locale.ROOT, "%02d", calendar.get(Calendar.SECOND));
     }
   },
+  MS("The millisecond as a decimal number (000-999)") {
+    @Override public String format(Date date) {
+      final Calendar calendar = Work.get().calendar;
+      calendar.setTime(date);
+      return String.format(Locale.ROOT, "%03d", calendar.get(Calendar.MILLISECOND));
+    }
+  },
   TZR("The time zone name") {
     @Override public String format(Date date) {
       // TODO: how to support timezones?
-      throw new UnsupportedOperationException();
+      return "";

Review Comment:
   We do so in order to match PostgreSQL's output when formatting `timestamp`s: https://dbfiddle.uk/VkeR6jUV



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org