DateTimeExtensions extension
Extension methods on DateTime for common date queries and manipulations that the Dart SDK leaves to third-party packages.
final now = DateTime.now();
print(now.isToday); // true
print(now.startOfDay); // DateTime with time set to 00:00:00
print(now.daysUntil(other)); // int number of days
- on
Properties
- endOfDay → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
A new DateTime at the end of this day (23:59:59.999) in the same timezone.no setter - endOfMonth → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
The last day of the month that contains this date.no setter - endOfYear → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
The last day of the year that contains this date.no setter - isToday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Whether this DateTime falls on today (same year, month, and day as DateTime.now).no setter - isTomorrow → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Whether this DateTime falls on the day after today.no setter - isWeekday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Whether this DateTime falls on a weekday (Monday–Friday).no setter - isWeekend → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Whether this DateTime falls on a Saturday or Sunday.no setter - isYesterday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Whether this DateTime falls on the day before today.no setter - startOfDay → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
A new DateTime at the start of this day (00:00:00.000) in the same timezone.no setter - startOfMonth → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
The first day of the month that contains this date.no setter - startOfYear → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
The first day of the year that contains this date.no setter
Methods
-
age(
{DateTime? now}) → int -
Available on DateTime, provided by the DateTimeExtensions extension
Calculates the number of full years between this date andnow. -
daysUntil(
DateTime other) → int -
Available on DateTime, provided by the DateTimeExtensions extension
Returns the number of calendar days between this date andother. -
isSameDay(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Whether this DateTime andotherrepresent the same calendar day (ignoring time).