DateExtension extension

Convenience methods for working with DateTime values.

on

Properties

dateOnly DateTime

Available on DateTime, provided by the DateExtension extension

Returns a DateTime with the date of the original, but time set to midnight.
no setter
daysInMonth List<DateTime>

Available on DateTime, provided by the DateExtension extension

The list of days in a given month
no setter
endOfDay DateTime

Available on DateTime, provided by the DateExtension extension

Returns the end of Current date
no setter
endOfMonth DateTime

Available on DateTime, provided by the DateExtension extension

Returns the end of the current month.
no setter
endOfYear DateTime

Available on DateTime, provided by the DateExtension extension

Returns the end of the current year.
no setter
firstDayOfMonth DateTime

Available on DateTime, provided by the DateExtension extension

Returns the first day of a given month
no setter
firstDayOfWeek DateTime

Available on DateTime, provided by the DateExtension extension

Returns the first day of week
no setter
firstDayOfYear DateTime

Available on DateTime, provided by the DateExtension extension

Returns the first day of the current year.
no setter
formatted String

Available on DateTime, provided by the DateExtension extension

Return date formatted string
no setter
isFirstDayOfMonth bool

Available on DateTime, provided by the DateExtension extension

Check if the first day of a month
no setter
isLastDayOfMonth bool

Available on DateTime, provided by the DateExtension extension

Check if the last day of a month
no setter
isToday bool

Available on DateTime, provided by the DateExtension extension

Check if the date is today
no setter
isTomorrow bool

Available on DateTime, provided by the DateExtension extension

Check if the date is tomorrow
no setter
isWeekday bool

Available on DateTime, provided by the DateExtension extension

Returns true when this date is Monday through Friday.
no setter
isWeekend bool

Available on DateTime, provided by the DateExtension extension

Returns true when this date is Saturday or Sunday.
no setter
isYesterday bool

Available on DateTime, provided by the DateExtension extension

Check if the date is yesterday, consider gap of year, month, day
no setter
lastDayOfMonth DateTime

Available on DateTime, provided by the DateExtension extension

The last day of a given month
no setter
lastDayOfWeek DateTime

Available on DateTime, provided by the DateExtension extension

Returns the last day of week
no setter
lastDayOfYear DateTime

Available on DateTime, provided by the DateExtension extension

Returns the last day of the current year.
no setter
nextDay DateTime

Available on DateTime, provided by the DateExtension extension

The day after this DateTime
no setter
nextMonth DateTime

Available on DateTime, provided by the DateExtension extension

Returns the next month
no setter
nextWeek DateTime

Available on DateTime, provided by the DateExtension extension

Returns the next week
no setter
previousDay DateTime

Available on DateTime, provided by the DateExtension extension

The day previous this DateTime
no setter
previousMonth DateTime

Available on DateTime, provided by the DateExtension extension

Returns the previous month
no setter
previousWeek DateTime

Available on DateTime, provided by the DateExtension extension

Returns the last week
no setter
startOfDay DateTime

Available on DateTime, provided by the DateExtension extension

Returns the start of Current date
no setter
startOfMonth DateTime

Available on DateTime, provided by the DateExtension extension

Returns the start of the current month.
no setter
startOfYear DateTime

Available on DateTime, provided by the DateExtension extension

Returns the start of the current year.
no setter
timeOnly Time

Available on DateTime, provided by the DateExtension extension

Returns only the time.
no setter

Methods

addDays(int amount) DateTime

Available on DateTime, provided by the DateExtension extension

Add a certain amount of days to this date
addHours(int amount) DateTime

Available on DateTime, provided by the DateExtension extension

Add a certain amount of hours to this date
addMinutes(int amount) DateTime

Available on DateTime, provided by the DateExtension extension

Add a certain amount of minutes to this date
addMonths(int amount) DateTime

Available on DateTime, provided by the DateExtension extension

Add a certain amount of months to this date and clamp overflow days.
addSeconds(int amount) DateTime

Available on DateTime, provided by the DateExtension extension

Add a certain amount of seconds to this date
addYears(int amount) DateTime

Available on DateTime, provided by the DateExtension extension

Add a certain amount of years to this date and clamp overflow days.
daysUntil(DateTime other) int

Available on DateTime, provided by the DateExtension extension

Returns the whole day difference from this date to other.
format([String? format]) String

Available on DateTime, provided by the DateExtension extension

Returns date formatted string with support for custom format
isBetween(DateTime start, DateTime end, {bool includeStart = true, bool includeEnd = true}) bool

Available on DateTime, provided by the DateExtension extension

Returns true if this date is between start and end.
isSameDay(DateTime b) bool

Available on DateTime, provided by the DateExtension extension

Whether or not two times are on the same day.
isSameMonth(DateTime b) bool

Available on DateTime, provided by the DateExtension extension

Whether or not two dates are in the same month.
isSameWeek(DateTime b) bool

Available on DateTime, provided by the DateExtension extension

Check if the date is on the same week for a given date
isSameYear(DateTime b) bool

Available on DateTime, provided by the DateExtension extension

Whether or not two dates are in the same year.