isSameDay method

bool isSameDay(
  1. DateTime b
)

Checks whether two DateTime instances are on the same day.

Example:

DateTime date1 = DateTime(2022, 1, 8, 12, 0);
DateTime date2 = DateTime(2022, 1, 8, 18, 30);

print(date1.isSameDay(date2));  // true

The isSameDay method compares the year, month, and day components of two DateTime instances. It returns true if they are on the same day and false otherwise.

Implementation

bool isSameDay(DateTime b) =>
    year == b.year && month == b.month && day == b.day;