{
  "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.",
  "type" : "scalar",
  "name" : "date_extract",
  "description" : "Extracts parts of a date, like year, month, day, hour.",
  "signatures" : [
    {
      "params" : [
        {
          "name" : "datePart",
          "type" : "keyword",
          "optional" : false,
          "description" : "Part of the date to extract.  Can be: `aligned_day_of_week_in_month`, `aligned_day_of_week_in_year`, `aligned_week_of_month`, `aligned_week_of_year`, `ampm_of_day`, `clock_hour_of_ampm`, `clock_hour_of_day`, `day_of_month`, `day_of_week`, `day_of_year`, `epoch_day`, `era`, `hour_of_ampm`, `hour_of_day`, `instant_seconds`, `micro_of_day`, `micro_of_second`, `milli_of_day`, `milli_of_second`, `minute_of_day`, `minute_of_hour`, `month_of_year`, `nano_of_day`, `nano_of_second`, `offset_seconds`, `proleptic_month`, `second_of_day`, `second_of_minute`, `year`, or `year_of_era`. Refer to {javadoc8}/java/time/temporal/ChronoField.html[java.time.temporal.ChronoField] for a description of these values.  If `null`, the function returns `null`."
        },
        {
          "name" : "date",
          "type" : "date",
          "optional" : false,
          "description" : "Date expression. If `null`, the function returns `null`."
        }
      ],
      "variadic" : false,
      "returnType" : "long"
    },
    {
      "params" : [
        {
          "name" : "datePart",
          "type" : "keyword",
          "optional" : false,
          "description" : "Part of the date to extract.  Can be: `aligned_day_of_week_in_month`, `aligned_day_of_week_in_year`, `aligned_week_of_month`, `aligned_week_of_year`, `ampm_of_day`, `clock_hour_of_ampm`, `clock_hour_of_day`, `day_of_month`, `day_of_week`, `day_of_year`, `epoch_day`, `era`, `hour_of_ampm`, `hour_of_day`, `instant_seconds`, `micro_of_day`, `micro_of_second`, `milli_of_day`, `milli_of_second`, `minute_of_day`, `minute_of_hour`, `month_of_year`, `nano_of_day`, `nano_of_second`, `offset_seconds`, `proleptic_month`, `second_of_day`, `second_of_minute`, `year`, or `year_of_era`. Refer to {javadoc8}/java/time/temporal/ChronoField.html[java.time.temporal.ChronoField] for a description of these values.  If `null`, the function returns `null`."
        },
        {
          "name" : "date",
          "type" : "date_nanos",
          "optional" : false,
          "description" : "Date expression. If `null`, the function returns `null`."
        }
      ],
      "variadic" : false,
      "returnType" : "long"
    },
    {
      "params" : [
        {
          "name" : "datePart",
          "type" : "text",
          "optional" : false,
          "description" : "Part of the date to extract.  Can be: `aligned_day_of_week_in_month`, `aligned_day_of_week_in_year`, `aligned_week_of_month`, `aligned_week_of_year`, `ampm_of_day`, `clock_hour_of_ampm`, `clock_hour_of_day`, `day_of_month`, `day_of_week`, `day_of_year`, `epoch_day`, `era`, `hour_of_ampm`, `hour_of_day`, `instant_seconds`, `micro_of_day`, `micro_of_second`, `milli_of_day`, `milli_of_second`, `minute_of_day`, `minute_of_hour`, `month_of_year`, `nano_of_day`, `nano_of_second`, `offset_seconds`, `proleptic_month`, `second_of_day`, `second_of_minute`, `year`, or `year_of_era`. Refer to {javadoc8}/java/time/temporal/ChronoField.html[java.time.temporal.ChronoField] for a description of these values.  If `null`, the function returns `null`."
        },
        {
          "name" : "date",
          "type" : "date",
          "optional" : false,
          "description" : "Date expression. If `null`, the function returns `null`."
        }
      ],
      "variadic" : false,
      "returnType" : "long"
    },
    {
      "params" : [
        {
          "name" : "datePart",
          "type" : "text",
          "optional" : false,
          "description" : "Part of the date to extract.  Can be: `aligned_day_of_week_in_month`, `aligned_day_of_week_in_year`, `aligned_week_of_month`, `aligned_week_of_year`, `ampm_of_day`, `clock_hour_of_ampm`, `clock_hour_of_day`, `day_of_month`, `day_of_week`, `day_of_year`, `epoch_day`, `era`, `hour_of_ampm`, `hour_of_day`, `instant_seconds`, `micro_of_day`, `micro_of_second`, `milli_of_day`, `milli_of_second`, `minute_of_day`, `minute_of_hour`, `month_of_year`, `nano_of_day`, `nano_of_second`, `offset_seconds`, `proleptic_month`, `second_of_day`, `second_of_minute`, `year`, or `year_of_era`. Refer to {javadoc8}/java/time/temporal/ChronoField.html[java.time.temporal.ChronoField] for a description of these values.  If `null`, the function returns `null`."
        },
        {
          "name" : "date",
          "type" : "date_nanos",
          "optional" : false,
          "description" : "Date expression. If `null`, the function returns `null`."
        }
      ],
      "variadic" : false,
      "returnType" : "long"
    }
  ],
  "examples" : [
    "ROW date = DATE_PARSE(\"yyyy-MM-dd\", \"2022-05-06\")\n| EVAL year = DATE_EXTRACT(\"year\", date)",
    "FROM sample_data\n| WHERE DATE_EXTRACT(\"hour_of_day\", @timestamp) < 9\n    AND DATE_EXTRACT(\"hour_of_day\", @timestamp) >= 17"
  ],
  "preview" : false,
  "snapshot_only" : false
}
