Contents

startOfDay(for:)

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

Declaration

func startOfDay(for date: Date) -> Date

Parameters

  • date:

    The date to search.

Return Value

The first moment of the given date.

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