<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSCalendar/date(era:yearForWeekOfYear:weekOfYear:weekday:hour:minute:second:nanosecond:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCalendar(im)dateWithEra:yearForWeekOfYear:weekOfYear:weekday:hour:minute:second:nanosecond:"
  },
  "title" : "date(era:yearForWeekOfYear:weekOfYear:weekday:hour:minute:second:nanosecond:)"
}
-->

# date(era:yearForWeekOfYear:weekOfYear:weekday:hour:minute:second:nanosecond:)

Returns a new date created with the given components base on a week-of-year value.

```
func date(era eraValue: Int, yearForWeekOfYear yearValue: Int, weekOfYear weekValue: Int, weekday weekdayValue: Int, hour hourValue: Int, minute minuteValue: Int, second secondValue: Int, nanosecond nanosecondValue: Int) -> Date?
```

## Parameters

`eraValue`

The value for the era component.

`yearValue`

The value for the year component.

`weekValue`

The value for the week-of-year component.

`weekdayValue`

The value to use as the weekday.

`hourValue`

The value for the hour component.

`minuteValue`

The value for the minute component.

`secondValue`

The value for the second component.

`nanosecondValue`

The value for the nanosecond component.

## Return Value

A new `NSDate` instance created with the given components based on a week-of-year calculation, or `nil` if the components do not correspond to a valid date.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)