DateTimeExtensions extension

Extensions for DateTime operations and utilities.

on

Properties

age int

Available on DateTime, provided by the DateTimeExtensions extension

Returns the age in years.
no setter
endOfDay DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the end of the day (23:59:59.999).
no setter
endOfMonth DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the end of the month.
no setter
endOfWeek DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the end of the week (Sunday).
no setter
endOfYear DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the end of the year.
no setter
isFuture bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is in the future.
no setter
isPast bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is in the past.
no setter
isToday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is today.
no setter
isTomorrow bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is tomorrow.
no setter
isYesterday bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is yesterday.
no setter
startOfDay DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the start of the day (00:00:00.000).
no setter
startOfMonth DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the start of the month.
no setter
startOfWeek DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the start of the week (Monday).
no setter
startOfYear DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns the start of the year.
no setter
timeAgo String

Available on DateTime, provided by the DateTimeExtensions extension

Returns a human-readable relative time string.
no setter

Methods

addDays(int days) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Adds days to the date.
addMonths(int months) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Adds months to the date.
addYears(int years) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Adds years to the date.
daysSince(DateTime other) int

Available on DateTime, provided by the DateTimeExtensions extension

Returns the number of days since other.
daysUntil(DateTime other) int

Available on DateTime, provided by the DateTimeExtensions extension

Returns the number of days between this date and other.
format(String pattern) String

Available on DateTime, provided by the DateTimeExtensions extension

Formats the date as a string using a pattern.
isBetween(DateTime start, DateTime end) bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is between two dates (inclusive).
isSameDay(DateTime other) bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is on the same day as other.
isSameMonth(DateTime other) bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is in the same month as other.
isSameWeek(DateTime other) bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is in the same week as other.
isSameYear(DateTime other) bool

Available on DateTime, provided by the DateTimeExtensions extension

Returns true if the date is in the same year as other.
subtractDays(int days) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Subtracts days from the date.
subtractMonths(int months) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Subtracts months from the date.
subtractYears(int years) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Subtracts years from the date.
toFormattedString() String

Available on DateTime, provided by the DateTimeExtensions extension

Returns a formatted date string (e.g., "January 15, 2024").
toShortFormattedString() String

Available on DateTime, provided by the DateTimeExtensions extension

Returns a short formatted date string (e.g., "Jan 15, 2024").