DHUDateExtensions extension

DHUDateExtensions

on

Properties

dateOnly DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing only the date part of this DateTime.
no setter
daysInMonth List<DateTime>

Available on DateTime, provided by the DHUDateExtensions extension

Returns a list of DateTimes representing the days in the same month as this DateTime.
no setter
firstDayOfMonth DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the first day of the month for this DateTime.
no setter
httpDateFormat String

Available on DateTime, provided by the DHUDateExtensions extension

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
isWeekday bool

Available on DateTime, provided by the DHUDateExtensions extension

Returns true if this date falls on a weekday.
no setter
isWeekend bool

Available on DateTime, provided by the DHUDateExtensions extension

Returns true if this date falls on a weekend.
no setter
lastDayOfMonth DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the last day of the month for this DateTime.
no setter
local DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Converts this DateTime to local time.
no setter
nextDay DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the next day relative to this DateTime.
no setter
nextMonth DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the next month relative to this DateTime.
no setter
nextWeek DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the next week relative to this DateTime.
no setter
passedDays int

Available on DateTime, provided by the DHUDateExtensions extension

Returns the number of days that have passed since this DateTime.
no setter
passedDuration Duration

Available on DateTime, provided by the DHUDateExtensions extension

Returns the duration that has passed since this DateTime.
no setter
previousDay DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the previous day relative to this DateTime.
no setter
previousMonth DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the previous month relative to this Date Time.
no setter
previousWeek DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the previous week relative to this DateTime.
no setter
remainingDays int

Available on DateTime, provided by the DHUDateExtensions extension

Returns the number of days remaining until this DateTime.
no setter
remainingDuration Duration

Available on DateTime, provided by the DHUDateExtensions extension

Returns the duration remaining until this DateTime.
no setter
startOfDay DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the start of the day for this DateTime.
no setter
startOfMonth DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the start of the month for this DateTime.
no setter
startOfYear DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the start of the year for this DateTime.
no setter
toIso String

Available on DateTime, provided by the DHUDateExtensions extension

Returns an ISO-8601 full-precision extended format representation.
no setter
tomorrow DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing tomorrow relative to this DateTime.
no setter
toUtcIso String

Available on DateTime, provided by the DHUDateExtensions extension

Converts this DateTime to UTC and returns an ISO 8601 string.
no setter
yesterday DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing yesterday relative to this DateTime.
no setter

Methods

addBusinessDays(int days) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds days business days to the current date, skipping weekends.
addDays(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds the specified number of days to this DateTime.
addHours(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds the specified number of hours to this DateTime.
addMicroseconds(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds the specified number of microseconds to this DateTime.
addMilliseconds(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds the specified number of milliseconds to this DateTime.
addMinutes(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds the specified number of minutes to this DateTime.
addOrSubtractDays(int days) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds or subtracts the specified number of days from this DateTime. Using a positive value (e.g., 1) adds days, while a negative value (e.g., -1) subtracts days.
addOrSubtractMicroseconds(int microseconds) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds or subtracts the specified number of microseconds from this DateTime. Using a positive value (e.g., 1) adds microseconds, while a negative value (e.g., -1) subtracts microseconds.
addOrSubtractMilliseconds(int milliseconds) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds or subtracts the specified number of milliseconds from this DateTime. Using a positive value (e.g., 1) adds milliseconds, while a negative value (e.g., -1) subtracts milliseconds.
addOrSubtractMinutes(int minutes) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds or subtracts the specified number of minutes from this DateTime. Using a positive value (e.g., 1) adds minutes, while a negative value (e.g., -1) subtracts minutes.
addOrSubtractMonths(int months) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds or subtracts the specified number of months from this DateTime. Using a positive value (e.g., 1) adds months, while a negative value (e.g., -1) subtracts months.
addOrSubtractSeconds(int seconds) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds or subtracts the specified number of seconds from this DateTime. Using a positive value (e.g., 1) adds seconds, while a negative value (e.g., -1) subtracts seconds.
addOrSubtractYears(int years) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds or subtracts the specified number of years from this DateTime. Using a positive value (e.g., 1) adds years, while a negative value (e.g., -1) subtracts years.
addSeconds(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds the specified number of seconds to this DateTime.
calculateAge() → ({int days, int months, int years})

Available on DateTime, provided by the DHUDateExtensions extension

calculates the age of a person based on the current date
ceilTo(Duration duration) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Ceils the DateTime to the nearest interval of the given duration.
clampBetween(DateTime start, DateTime end) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Clamps this DateTime between start and end.
copyWith({int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond, bool? isUtc}) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a new DateTime with the provided fields replaced.
daysDifferenceTo([DateTime? other]) int

Available on DateTime, provided by the DHUDateExtensions extension

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>

Available on DateTime, provided by the DHUDateExtensions extension

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

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the first day of the week for this DateTime.
floorTo(Duration duration) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Floors the DateTime to the nearest interval of the given duration.
isAtSameDayAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime is on the same day, month, and year as other.
isAtSameHourAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime is in the same hour, day, month, and year as other.
isAtSameMicrosecondAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime is in the same microsecond, millisecond, second, minute, hour, day, month, and year as other.
isAtSameMillisecondAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime is in the same millisecond, second, minute, hour, day, month, and year as other.
isAtSameMinuteAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime is in the same minute, hour, day, month, and year as other.
isAtSameMonthAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime is in the same month and year as other.
isAtSameSecondAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime is in the same second, minute, hour, day, month, and year as other.
isAtSameYearAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime is in the same year as other.
isBetween(DateTime start, DateTime end, {bool inclusiveStart = true, bool inclusiveEnd = false, bool ignoreTime = false, bool normalize = false}) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime falls between two other DateTime objects, with options for inclusive or exclusive boundaries and timezone handling.
isSameDayAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime occurs on the same day as another DateTime, regardless of time zone.
isSameHourAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime occurs on the same hour as another DateTime, regardless of time zone.
isSameMonthAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime is in the same month and year as other.
isSameWeekAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime occurs within the same week as another DateTime, regardless of time zone. Considers a week to start on Monday.
isSameYearAs(DateTime other) bool

Available on DateTime, provided by the DHUDateExtensions extension

Checks if this DateTime is in the same year as other.
lastDayOfWeek({int startOfWeek = DateTime.monday}) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns a DateTime representing the last day of the week for this DateTime.
max(DateTime that) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns the maximum of this DateTime and that.
min(DateTime that) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Returns the minimum of this DateTime and that.
roundTo(Duration duration) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Rounds the DateTime to the nearest interval of the given duration.
subtractDays(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Subtracts the specified number of days from this DateTime.
subtractHours(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Subtracts the specified number of hours from this DateTime.
subtractMicroseconds(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Subtracts the specified number of microseconds from this DateTime.
subtractMilliseconds(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Subtracts the specified number of milliseconds from this DateTime.
subtractMinutes(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Subtracts the specified number of minutes from this DateTime.
subtractSeconds(int amount) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Subtracts the specified number of seconds from this DateTime.

Operators

operator +(Duration duration) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Adds the specified duration to this DateTime.
operator -(Duration duration) DateTime

Available on DateTime, provided by the DHUDateExtensions extension

Subtracts the specified duration from this DateTime.