# `Predicator.Functions.DateFunctions`
[🔗](https://github.com/riddler/predicator-ex/blob/v9.5.0/lib/predicator/functions/date_functions.ex#L1)

Date and time related functions for use in predicator expressions.

This module provides temporal functions for working with dates, times,
durations, and relative date calculations.

## Available Functions

### Date/Time Functions
- `year(date)` - Extracts the year from a date or datetime
- `month(date)` - Extracts the month from a date or datetime
- `day(date)` - Extracts the day from a date or datetime
- `now()` - Returns the current UTC datetime (alias for Date.now())

## Examples

    iex> Predicator.Functions.DateFunctions.call_year([~D[2023-05-15]], %{})
    {:ok, 2023}

    iex> Predicator.Functions.DateFunctions.call_date_now([], %{})
    {:ok, %DateTime{}}

# `function_result`

```elixir
@type function_result() :: {:ok, Predicator.Types.value()} | {:error, binary()}
```

# `call_date_now`

```elixir
@spec call_date_now([Predicator.Types.value()], Predicator.Context.t()) ::
  function_result()
```

Returns the current UTC datetime (alias for `Date.now()`).

# `call_day`

```elixir
@spec call_day([Predicator.Types.value()], Predicator.Context.t()) ::
  function_result()
```

Extracts the day from a date or datetime.

# `call_month`

```elixir
@spec call_month([Predicator.Types.value()], Predicator.Context.t()) ::
  function_result()
```

Extracts the month from a date or datetime.

# `call_year`

```elixir
@spec call_year([Predicator.Types.value()], Predicator.Context.t()) ::
  function_result()
```

Extracts the year from a date or datetime.

# `functions`

```elixir
@spec functions() :: %{
  required(Predicator.FunctionProvider.name()) =&gt;
    Predicator.FunctionProvider.entry()
}
```

Returns all date functions as a `Predicator.FunctionProvider` map.

## Returns

A map where keys are function names and values are `{arity, atom}` pairs -
`atom` naming a public `call_*/2` function on this module.

## Examples

    iex> functions = Predicator.Functions.DateFunctions.functions()
    iex> Map.has_key?(functions, "Date.year")
    true

    iex> {arity, _atom} = functions["Date.year"]
    iex> arity
    1

---

*Consult [api-reference.md](api-reference.md) for complete listing*
