From b3b66c729db579214f8f0a76ce97bb38a34bbe04 Mon Sep 17 00:00:00 2001 From: Rakhi Prathap Date: Wed, 18 Jun 2025 15:53:36 +0530 Subject: [PATCH 1/4] Add new date formats --- .../n1ql-language-reference/datefun.adoc | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/modules/n1ql/pages/n1ql-language-reference/datefun.adoc b/modules/n1ql/pages/n1ql-language-reference/datefun.adoc index 7a0662641..32e5fd049 100644 --- a/modules/n1ql/pages/n1ql-language-reference/datefun.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/datefun.adoc @@ -504,6 +504,71 @@ The elements are given in the table below. | Seconds since 1970-01-01 00:00:00 UTC | `1624904579` +| `x` +| Same as `%D` +| `2021-06-28` + +| `r` +| 12-hour time, including AM/PM (hh:mm:ss AM/PM) +| `07:22:59 PM` + +| `X` +| Same as `%T` +| `19:22:59` + +| `:z` +| Time zone or UTC offset in the format, +HH:MM +| `+05:30` + +| `::z` +| Time zone or UTC offset in the format, +HH:MM:SS +| `+05:30:00` + +| `:::z` +| Time zone with minimum precision as required +| `+05:30` or `+05:30:00` + +| `V` +| ISO week number +| `27` + +| `G` +| Year for ISO week number +| `2025` + +| `j` +| Day of the year +| `179` + +| `q` +| Quarter (1...4) +| `2` + +| `w` +| Weekday (Sunday == 0) +| `1` + +| `u` +| Weekday (Monday == 1, Sunday == 7) +| `2` + + +| `U` +| Week number of year (Sunday is first day of the week) +| `27` + +| `W` +| Week number of year (Monday is first day of the week) +| `27` + +| `#` +| Time since the Epoch time in the format [total hours]h:mm:ss +| `12345h:27:15` + +| `@` +| Time since the Epoch time in the format [total hours]h:mm:ss.fff +| `12345h:27:15.123` + |==== To specify a date format, you can put the format specifiers together in any order, along with any other characters as required. From 55743da346ae437f72be0a57b99a9da89f6fb7da Mon Sep 17 00:00:00 2001 From: Rakhi Prathap Date: Wed, 18 Jun 2025 16:20:03 +0530 Subject: [PATCH 2/4] Minor changes --- .../n1ql-language-reference/datefun.adoc | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/n1ql/pages/n1ql-language-reference/datefun.adoc b/modules/n1ql/pages/n1ql-language-reference/datefun.adoc index 32e5fd049..f34d14e30 100644 --- a/modules/n1ql/pages/n1ql-language-reference/datefun.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/datefun.adoc @@ -509,23 +509,23 @@ The elements are given in the table below. | `2021-06-28` | `r` -| 12-hour time, including AM/PM (hh:mm:ss AM/PM) -| `07:22:59 PM` +| 12-hour time in the format, hh:mm:ss am/pm +| `07:22:59 am` | `X` | Same as `%T` | `19:22:59` | `:z` -| Time zone or UTC offset in the format, +HH:MM +| UTC offset in the format, +HH:MM | `+05:30` | `::z` -| Time zone or UTC offset in the format, +HH:MM:SS +| UTC offset in the format, +HH:MM:SS | `+05:30:00` | `:::z` -| Time zone with minimum precision as required +| UTC offset with minimum precision as required for the time zone | `+05:30` or `+05:30:00` | `V` @@ -533,7 +533,7 @@ The elements are given in the table below. | `27` | `G` -| Year for ISO week number +| Year corresponding to the ISO week number | `2025` | `j` @@ -541,15 +541,15 @@ The elements are given in the table below. | `179` | `q` -| Quarter (1...4) +| Quarter of the year, 1-4 | `2` | `w` -| Weekday (Sunday == 0) +| Day of the week (Sunday=0) | `1` | `u` -| Weekday (Monday == 1, Sunday == 7) +| Day of the week (Monday=1, Sunday=7) | `2` @@ -562,11 +562,11 @@ The elements are given in the table below. | `27` | `#` -| Time since the Epoch time in the format [total hours]h:mm:ss +| Time since Epoch in the format, h:mm:ss | `12345h:27:15` | `@` -| Time since the Epoch time in the format [total hours]h:mm:ss.fff +| Time since Epoch in the format, h:mm:ss.fff | `12345h:27:15.123` |==== From 5f7fe18e20bbcd11d5a5a8118e5049a3608291f7 Mon Sep 17 00:00:00 2001 From: Rakhi Prathap Date: Wed, 18 Jun 2025 16:54:40 +0530 Subject: [PATCH 3/4] Minor tweak --- modules/n1ql/pages/n1ql-language-reference/datefun.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/n1ql/pages/n1ql-language-reference/datefun.adoc b/modules/n1ql/pages/n1ql-language-reference/datefun.adoc index f34d14e30..b0669bbea 100644 --- a/modules/n1ql/pages/n1ql-language-reference/datefun.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/datefun.adoc @@ -509,7 +509,7 @@ The elements are given in the table below. | `2021-06-28` | `r` -| 12-hour time in the format, hh:mm:ss am/pm +| 12-hour time, hh:mm:ss am/pm | `07:22:59 am` | `X` From 40e33c74d7135e8a9dc665f642139705326c9708 Mon Sep 17 00:00:00 2001 From: Rakhi Prathap Date: Wed, 18 Jun 2025 18:50:56 +0530 Subject: [PATCH 4/4] Updated a few examples and formats based on testing results --- .../n1ql/pages/n1ql-language-reference/datefun.adoc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/n1ql/pages/n1ql-language-reference/datefun.adoc b/modules/n1ql/pages/n1ql-language-reference/datefun.adoc index b0669bbea..a7f719955 100644 --- a/modules/n1ql/pages/n1ql-language-reference/datefun.adoc +++ b/modules/n1ql/pages/n1ql-language-reference/datefun.adoc @@ -509,8 +509,8 @@ The elements are given in the table below. | `2021-06-28` | `r` -| 12-hour time, hh:mm:ss am/pm -| `07:22:59 am` +| 12-hour time, hh:mm:ss AM/PM +| `07:22:59 AM` | `X` | Same as `%T` @@ -562,12 +562,13 @@ The elements are given in the table below. | `27` | `#` -| Time since Epoch in the format, h:mm:ss -| `12345h:27:15` +| Time since Epoch in the format, [total hours]:mm:ss +| `406464:27:15` + | `@` -| Time since Epoch in the format, h:mm:ss.fff -| `12345h:27:15.123` +| Time since Epoch in the format, [total hours]:mm:ss.fff +| `406464:27:15.123` |====