dateOnly property

DateTime dateOnly

Returns an instance of DateTime without time related values. This is intended to remove hour, minute, second and millisecond information from DateTime instance which leaves only date information. Example: final date = DateTime().now(); // 26-07-2020 16:54:23 date.dateOnly // 26-07-2020 This is helpful in cases where comparison of only dates is required.

Implementation

DateTime get dateOnly => DateTime(year, month, day);