> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metrics-man.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dayofyear

# \$dayOfYear

The `$dayOfYear` operator extracts the day of the year from a date object (0-365).

## Input

* A single date object

## Output

* The day of the year as an integer (0-365, where 0 is January 1)

## Examples

### Extract Day of Year from Date

```json theme={null}
{
  "$dayOfYear": [
    {
      "$toDate": ["2023-01-15T10:30:00Z"]
    }
  ]
}
```

Result: `14` (January 15 is the 15th day of the year, 0-indexed as 14)

### Extract Day of Year from Field

```json theme={null}
{
  "$dayOfYear": [
    {
      "$input": "event_date"
    }
  ]
}
```

Result: The day of the year (0-365) of the event\_date field
