---
title: "date(bySettingHour:minute:second:of:options:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nscalendar/date(bysettinghour:minute:second:of:options:)"
---

# date(bySettingHour:minute:second:of:options:)

Creates a new date calculated with the given time.

## Declaration

```swift
func date(bySettingHour h: Int, minute m: Int, second s: Int, of date: Date, options opts: NSCalendar.Options = []) -> Date?
```

## Parameters

- `h`: The hour value.
- `m`: The minute value.
- `s`: The second value.
- `date`: The date to use to perform the calculation.
- `opts`: Options for the calculation. For possible values, see doc://com.apple.foundation/documentation/Foundation/NSCalendar/Options.

## Return Value

Return Value A new NSDate instance representing the date calculated by setting the given hour, minute, and second, to a given time. If no such time exists for the specified components, the next available date is returned, which may be on a different calendar day.

## Discussion

Discussion You can use this method to calculate a date at a different time of a particular calendar day.

## 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(bySettingUnit:value:of:options:)](foundation/nscalendar/date(bysettingunit:value:of:options:).md)
- [date(era:year:month:day:hour:minute:second:nanosecond:)](foundation/nscalendar/date(era:year:month:day:hour:minute:second:nanosecond:).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)
