---
title: "date(era:year:month:day:hour:minute:second:nanosecond:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nscalendar/date(era:year:month:day:hour:minute:second:nanosecond:)"
---

# date(era:year:month:day:hour:minute:second:nanosecond:)

Returns a date created with the given components.

## Declaration

```swift
func date(era eraValue: Int, year yearValue: Int, month monthValue: Int, day dayValue: Int, hour hourValue: Int, minute minuteValue: Int, second secondValue: Int, nanosecond nanosecondValue: Int) -> Date?
```

## Parameters

- `eraValue`: The value to set for the era.
- `yearValue`: The value to set for the year.
- `monthValue`: The value to set for the month.
- `dayValue`: The value to set for the day.
- `hourValue`: The value to set for the hour.
- `minuteValue`: The value to set for the minute.
- `secondValue`: The value to set for the second.
- `nanosecondValue`: The value to set for the nanosecond.

## Return Value

Return Value A new NSDate instance created with the given components, or nil if the components do not correspond to a valid date.

## See Also

### Calculating Dates

- [date(from:)](foundation/nscalendar/date(from:).md)
- [date(byAdding:to:options:)](foundation/nscalendar/date(byadding:to:options:).md)
- [date(byAdding:value:to:options:)](foundation/nscalendar/date(byadding:value:to:options:).md)
- [date(bySettingHour:minute:second:of:options:)](foundation/nscalendar/date(bysettinghour:minute:second:of:options:).md)
- [date(bySettingUnit:value:of:options:)](foundation/nscalendar/date(bysettingunit:value:of:options:).md)
- [date(era:yearForWeekOfYear:weekOfYear:weekday:hour:minute:second:nanosecond:)](foundation/nscalendar/date(era:yearforweekofyear:weekofyear:weekday:hour:minute:second:nanosecond:).md)
- [nextWeekendStart(_:interval:options:after:)](foundation/nscalendar/nextweekendstart(_:interval:options:after:).md)
