DHUDateExtensions extension
Properties
-
dateOnly
→ DateTime
-
Returns a DateTime representing only the date part of this DateTime.
no setter
-
daysInMonth
→ List<DateTime>
-
Returns a list of DateTimes representing the days in the same month as this DateTime.
no setter
-
firstDayOfMonth
→ DateTime
-
Returns a DateTime representing the first day of the month for this DateTime.
no setter
-
httpFormat
→ String
-
Format a date to "DAY, DD MON YYYY hh:mm:ss GMT" according to
RFC-1123,
e.g.
Thu, 1 Jan 1970 00:00:00 GMT
.
no setter
-
lastDayOfMonth
→ DateTime
-
Returns a DateTime representing the last day of the month for this DateTime.
no setter
-
local
→ DateTime
-
Converts this DateTime to local time.
no setter
-
nextDay
→ DateTime
-
Returns a DateTime representing the next day relative to this DateTime.
no setter
-
nextMonth
→ DateTime
-
Returns a DateTime representing the next month relative to this DateTime.
no setter
-
nextWeek
→ DateTime
-
Returns a DateTime representing the next week relative to this DateTime.
no setter
-
passedDays
→ int
-
Returns the number of days that have passed since this DateTime.
no setter
-
passedDuration
→ Duration
-
Returns the duration that has passed since this DateTime.
no setter
-
previousDay
→ DateTime
-
Returns a DateTime representing the previous day relative to this DateTime.
no setter
-
previousMonth
→ DateTime
-
Returns a DateTime representing the previous month relative to this Date Time.
no setter
-
previousWeek
→ DateTime
-
Returns a DateTime representing the previous week relative to this DateTime.
no setter
-
remainingDays
→ int
-
Returns the number of days remaining until this DateTime.
no setter
-
remainingDuration
→ Duration
-
Returns the duration remaining until this DateTime.
no setter
-
startOfDay
→ DateTime
-
Returns a DateTime representing the start of the day for this DateTime.
no setter
-
startOfMonth
→ DateTime
-
Returns a DateTime representing the start of the month for this DateTime.
no setter
-
startOfYear
→ DateTime
-
Returns a DateTime representing the start of the year for this DateTime.
no setter
-
toIso
→ String
-
Returns an ISO-8601 full-precision extended format representation.
no setter
-
tomorrow
→ DateTime
-
Returns a DateTime representing tomorrow relative to this DateTime.
no setter
-
toUtcIso
→ String
-
Converts this DateTime to UTC and returns an ISO 8601 string.
no setter
-
yesterday
→ DateTime
-
Returns a DateTime representing yesterday relative to this DateTime.
no setter
Methods
-
addDays(int amount)
→ DateTime
-
Adds the specified number of days to this DateTime.
-
addHours(int amount)
→ DateTime
-
Adds the specified number of hours to this DateTime.
-
addOrRemoveDays(int days)
→ DateTime
-
Adds or removes the specified number of days from this DateTime.
-
addOrRemoveMinutes(int minutes)
→ DateTime
-
Adds or removes the specified number of minutes from this DateTime.
-
addOrRemoveMonths(int months)
→ DateTime
-
Adds or removes the specified number of months from this DateTime.
-
addOrRemoveSeconds(int seconds)
→ DateTime
-
Adds or removes the specified number of seconds from this DateTime.
-
addOrRemoveYears(int years)
→ DateTime
-
Adds or removes the specified number of years from this DateTime.
-
daysDifferenceTo([DateTime? other])
→ int
-
Calculates the absolute difference in whole days between this DateTime
and another DateTime (or the current time if none is provided).
Ignores hours, minutes, seconds, and milliseconds.
-
daysUpTo(DateTime end)
→ Iterable<DateTime>
-
Generates a sequence of DateTime objects representing each day in the range
starting from
this
DateTime (inclusive) up to but not including the end
DateTime.
-
firstDayOfWeek({int startOfWeek = DateTime.monday})
→ DateTime
-
Returns a DateTime representing the first day of the week for this DateTime.
-
isAtSameDayAs(DateTime other)
→ bool
-
Checks if this DateTime is on the same day, month, and year as
other
.
-
isAtSameHourAs(DateTime other)
→ bool
-
Checks if this DateTime is in the same hour, day, month, and year as
other
.
-
isAtSameMicrosecondAs(DateTime other)
→ bool
-
Checks if this DateTime is in the same microsecond, millisecond, second, minute, hour, day, month, and year as
other
.
-
isAtSameMillisecondAs(DateTime other)
→ bool
-
Checks if this DateTime is in the same millisecond, second, minute, hour, day, month, and year as
other
.
-
isAtSameMinuteAs(DateTime other)
→ bool
-
Checks if this DateTime is in the same minute, hour, day, month, and year as
other
.
-
isAtSameMonthAs(DateTime other)
→ bool
-
Checks if this DateTime is in the same month and year as
other
.
-
isAtSameSecondAs(DateTime other)
→ bool
-
Checks if this DateTime is in the same second, minute, hour, day, month, and year as
other
.
-
isAtSameYearAs(DateTime other)
→ bool
-
Checks if this DateTime is in the same year as
other
.
-
isSameDayAs(DateTime other)
→ bool
-
Checks if this DateTime occurs on the same day as another DateTime,
regardless of time zone.
-
isSameHourAs(DateTime other)
→ bool
-
Checks if this DateTime occurs on the same hour as another DateTime,
regardless of time zone.
-
isSameWeekAs(DateTime other)
→ bool
-
Checks if this DateTime occurs within the same week as another DateTime,
regardless of time zone. Considers a week to start on Monday.
-
lastDayOfWeek({int startOfWeek = DateTime.monday})
→ DateTime
-
Returns a DateTime representing the last day of the week for this DateTime.
-
max(DateTime that)
→ DateTime
-
Returns the maximum of this DateTime and
that
.
-
min(DateTime that)
→ DateTime
-
Returns the minimum of this DateTime and
that
.