Instance Method

isDate(_:inSameDayAs:)

Indicates whether two dates are in the same day.

Declaration

func isDate(_ date1: Date, inSameDayAs date2: Date) -> Bool

Parameters

date1

The first date to compare.

date2

The second date to compare.

Return Value

true if both dates are within the same day, otherwise false.

See Also

Comparing Dates

func compare(Date, to: Date, toUnitGranularity: NSCalendar.Unit)

Indicates the ordering of two given dates based on their components down to a given unit granularity.

func isDate(Date, equalTo: Date, toUnitGranularity: NSCalendar.Unit)

Indicates whether two dates are equal to a given unit of granularity.

func isDateInToday(Date)

Indicates whether the given date is in “today.”

func isDateInTomorrow(Date)

Indicates whether the given date is in “tomorrow.”

func isDateInWeekend(Date)

Indicates whether a given date falls within a weekend period, as defined by the calendar and the calendar's locale.

func isDateInYesterday(Date)

Indicates whether the given date is in “yesterday.”