Skip to content

Commit 072c619

Browse files
committed
add date time MySQL-style patterns to convert
1 parent fd596d4 commit 072c619

File tree

1 file changed

+9
-1
lines changed
  • sql/src/main/scala/app/softnetwork/elastic/sql/function/time

1 file changed

+9
-1
lines changed

sql/src/main/scala/app/softnetwork/elastic/sql/function/time/package.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,16 +345,24 @@ package object time {
345345
"%d" -> "dd",
346346
"%e" -> "d",
347347
"%H" -> "HH",
348+
"%k" -> "H",
348349
"%h" -> "hh",
349350
"%I" -> "hh",
351+
"%l" -> "h",
350352
"%i" -> "mm",
351353
"%s" -> "ss",
354+
"%S" -> "ss",
352355
"%f" -> "SSS", // microseconds
353356
"%p" -> "a",
354357
"%W" -> "EEEE",
355358
"%a" -> "EEE",
356359
"%M" -> "MMMM",
357-
"%b" -> "MMM"
360+
"%b" -> "MMM",
361+
"%T" -> "HH:mm:ss",
362+
"%r" -> "hh:mm:ss a",
363+
"%j" -> "DDD",
364+
"%x" -> "YY",
365+
"%X" -> "YYYY"
358366
)
359367

360368
def convert(includeTimeZone: Boolean = false): String = {

0 commit comments

Comments
 (0)