DateTimeBasics extension

Utility extension methods for the core DateTime class.

on

Methods

addCalendarDays(int numberOfDays) DateTime

Available on DateTime, provided by the DateTimeBasics extension

Adds a specified number of days to this DateTime.
calendarDaysTill(int year, int month, int day) int

Available on DateTime, provided by the DateTimeBasics extension

Returns the number of calendar days till the specified date.
copyWith({int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond}) DateTime

Available on DateTime, provided by the DateTimeBasics extension

Copies a DateTime, overriding specified values.
isAtOrAfter(DateTime other) bool

Available on DateTime, provided by the DateTimeBasics extension

Returns true if this occurs at or after other, accounting for time zones.
isAtOrBefore(DateTime other) bool

Available on DateTime, provided by the DateTimeBasics extension

Returns true if this occurs at or before other, accounting for time zones.

Operators

operator +(Duration duration) DateTime

Available on DateTime, provided by the DateTimeBasics extension

Returns a new DateTime instance with duration added to this.
operator -(DateTime other) Duration

Available on DateTime, provided by the DateTimeBasics extension

Returns the Duration between this and other.
operator <(DateTime other) bool

Available on DateTime, provided by the DateTimeBasics extension

Returns true if this occurs strictly before other, accounting for time zones.
operator <=(DateTime other) bool

Available on DateTime, provided by the DateTimeBasics extension

Returns true if this occurs at or before other, accounting for time zones.
operator >(DateTime other) bool

Available on DateTime, provided by the DateTimeBasics extension

Returns true if this occurs strictly after other, accounting for time zones.
operator >=(DateTime other) bool

Available on DateTime, provided by the DateTimeBasics extension

Returns true if this occurs at or after other, accounting for time zones.