---
title: "component(_:from:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/calendar/component(_:from:)"
---

# component(_:from:)

Returns the value for one component of a date.

## Declaration

```swift
func component(_ component: Calendar.Component, from date: Date) -> Int
```

## Parameters

- `component`: The component to calculate.
- `date`: The date to use.

## Return Value

Return Value The value for the component.

## See Also

### Extracting Components

- [date(_:matchesComponents:)](foundation/calendar/date(_:matchescomponents:).md)
- [dateComponents(_:from:)](foundation/calendar/datecomponents(_:from:).md)
- [dateComponents(_:from:to:)](foundation/calendar/datecomponents(_:from:to:)-2kcg.md)
- [dateComponents(_:from:to:)](foundation/calendar/datecomponents(_:from:to:)-5g20t.md)
- [dateComponents(in:from:)](foundation/calendar/datecomponents(in:from:).md)
- [Calendar.Component](foundation/calendar/component.md)
