Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
* [`DATE_PARSE`](../../functions-operators/date-time-functions.md#esql-date_parse)
* [`DATE_TRUNC`](../../functions-operators/date-time-functions.md#esql-date_trunc)
* [`DAY_NAME`](../../functions-operators/date-time-functions.md#esql-day_name)
* [`MONTH_NAME`](../../functions-operators/date-time-functions.md#esql-month_name)
* [`NOW`](../../functions-operators/date-time-functions.md#esql-now)
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ mapped_pages:
:::{include} ../_snippets/functions/layout/day_name.md
:::

:::{include} ../_snippets/functions/layout/month_name.md
:::

:::{include} ../_snippets/functions/layout/now.md
:::

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1930,3 +1930,101 @@ from employees | where emp_no == 10040 | eval x = day_name(birth_date) | keep em
emp_no:integer | birth_date:date | hire_date:date | x:keyword
10040 | null | 1993-02-14T00:00:00.000Z | null
;


monthNameRowTest
required_capability:fn_month_name
// tag::docsMonthName[]
ROW dt = to_datetime("1996-03-21T00:00:00.000Z")
| EVAL monthName = MONTH_NAME(dt);
// end::docsMonthName[]

dt:date | monthName:keyword
1996-03-21T00:00:00.000Z | March
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do tag::docsMonthName-result then you can include this result table - it gets rendered as an actual html table.

;

monthNameSimple
required_capability:fn_month_name
from employees
| sort emp_no
| keep emp_no, hire_date
| eval monthName = month_name(hire_date)
| limit 1;

emp_no:integer | hire_date:date | monthName:keyword
10001 | 1986-06-26T00:00:00.000Z | June
;

monthNameTruncate
required_capability:fn_month_name
FROM employees
| EVAL a = hire_date
| RENAME hire_date as b
| WHERE a > "1987-01-01" and a < "1988-01-01"
| EVAL y = date_trunc(1 month, b)
| STATS c = count(emp_no) by y
| EVAL monthName = month_name(y)
| SORT y
| KEEP y, c, monthName
| LIMIT 5;

y:date | c:long | monthName:keyword
1987-03-01T00:00:00.000Z | 5 | March
1987-04-01T00:00:00.000Z | 3 | April
1987-05-01T00:00:00.000Z | 1 | May
1987-07-01T00:00:00.000Z | 1 | July
1987-08-01T00:00:00.000Z | 2 | August
;

monthNameNestedCall
required_capability:fn_month_name
from employees
| sort emp_no
| eval monthName = month_name(date_trunc(1 month, hire_date))
| keep emp_no, hire_date, monthName
| limit 10;

emp_no:integer | hire_date:datetime | monthName:keyword
10001 | 1986-06-26T00:00:00.000Z | June
10002 | 1985-11-21T00:00:00.000Z | November
10003 | 1986-08-28T00:00:00.000Z | August
10004 | 1986-12-01T00:00:00.000Z | December
10005 | 1989-09-12T00:00:00.000Z | September
10006 | 1989-06-02T00:00:00.000Z | June
10007 | 1989-02-10T00:00:00.000Z | February
10008 | 1994-09-15T00:00:00.000Z | September
10009 | 1985-02-18T00:00:00.000Z | February
10010 | 1989-08-24T00:00:00.000Z | August
;

monthNameNestedCall
required_capability:fn_month_name
from employees
| sort emp_no desc
| eval monthName = to_upper(month_name(date_trunc(1 month, hire_date)))
| keep emp_no, hire_date, monthName
| limit 10;

emp_no:integer | hire_date:datetime | monthName:keyword
10100 | 1987-09-21T00:00:00.000Z | SEPTEMBER
10099 | 1988-10-18T00:00:00.000Z | OCTOBER
10098 | 1985-05-13T00:00:00.000Z | MAY
10097 | 1990-09-15T00:00:00.000Z | SEPTEMBER
10096 | 1990-01-14T00:00:00.000Z | JANUARY
10095 | 1986-07-15T00:00:00.000Z | JULY
10094 | 1987-04-18T00:00:00.000Z | APRIL
10093 | 1996-11-05T00:00:00.000Z | NOVEMBER
10092 | 1989-09-22T00:00:00.000Z | SEPTEMBER
10091 | 1992-11-18T00:00:00.000Z | NOVEMBER
;

monthNameNull
required_capability:fn_month_name
from employees
| where emp_no == 10040
| eval monthName = month_name(birth_date)
| keep emp_no, birth_date, hire_date, monthName;

emp_no:integer | birth_date:date | hire_date:date | monthName:keyword
10040 | null | 1993-02-14T00:00:00.000Z | null
;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading