---
title: "startOfDay(for:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/calendar/startofday(for:)"
---

# startOfDay(for:)

Returns the first moment of a given Date, as a Date.

## Declaration

```swift
func startOfDay(for date: Date) -> Date
```

## Parameters

- `date`: The date to search.

## Return Value

Return Value The first moment of the given date.

## Discussion

Discussion For example, pass in Date(), if you want the start of today. If there were two midnights, it returns the first.  If there was none, it returns the first moment that did exist.

## See Also

### Scanning Dates

- [enumerateDates(startingAfter:matching:matchingPolicy:repeatedTimePolicy:direction:using:)](foundation/calendar/enumeratedates(startingafter:matching:matchingpolicy:repeatedtimepolicy:direction:using:).md)
- [nextDate(after:matching:matchingPolicy:repeatedTimePolicy:direction:)](foundation/calendar/nextdate(after:matching:matchingpolicy:repeatedtimepolicy:direction:).md)
- [Calendar.MatchingPolicy](foundation/calendar/matchingpolicy.md)
- [Calendar.RepeatedTimePolicy](foundation/calendar/repeatedtimepolicy.md)
