---
title: dayOfYear
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/datecomponents/dayofyear
---

# dayOfYear

A day of the year. For example, in the Gregorian calendar, can go from 1 to 365 or 1 to 366 in leap years.

## Declaration

```swift
var dayOfYear: Int? { get set }
```

## Discussion

Discussion note: This value is interpreted in the context of the calendar in which it is used.
