---
title: "value(for:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/datecomponents/value(for:)"
---

# value(for:)

Returns the value of one of the properties, using an enumeration value instead of a property name.

## Declaration

```swift
func value(for component: Calendar.Component) -> Int?
```

## Discussion

Discussion The calendar and timeZone and isLeapMonth property values cannot be retrieved by this method.

## See Also

### Accessing Calendar Components

- [setValue(_:for:)](foundation/datecomponents/setvalue(_:for:).md)
- [Calendar.Component](foundation/calendar/component.md)
