DateTimeX extension
Utilities and convenience getters for DateTime objects.
- on
Properties
- dayOfYear → int
-
Available on DateTime, provided by the DateTimeX extension
1-based day of the year (1 through 365 or 366).no setter - daysInMonth → int
-
Available on DateTime, provided by the DateTimeX extension
Number of days in this date's month (leap-year aware).no setter - endOfDay → DateTime
-
Available on DateTime, provided by the DateTimeX extension
Returns the end of the calendar day (23:59:59.999999).no setter - endOfHour → DateTime
-
Available on DateTime, provided by the DateTimeX extension
End of the hour (:59:59.999999).no setter - endOfMonth → DateTime
-
Available on DateTime, provided by the DateTimeX extension
Returns the end of the month (last day at 23:59:59.999999).no setter - endOfQuarter → DateTime
-
Available on DateTime, provided by the DateTimeX extension
End of the calendar quarter (last day at23:59:59.999999).no setter - endOfYear → DateTime
-
Available on DateTime, provided by the DateTimeX extension
End of the year (December 31st at23:59:59.999999).no setter - isFuture → bool
-
Available on DateTime, provided by the DateTimeX extension
Whether this moment is still ahead.no setter - isLeapYear → bool
-
Available on DateTime, provided by the DateTimeX extension
Whether the year of this date is a leap year.no setter - isPast → bool
-
Available on DateTime, provided by the DateTimeX extension
Whether this moment has already passed.no setter - isToday → bool
-
Available on DateTime, provided by the DateTimeX extension
Whether this date falls on today's calendar date.no setter - isTomorrow → bool
-
Available on DateTime, provided by the DateTimeX extension
Whether this date falls on tomorrow's calendar date.no setter - isWeekday → bool
-
Available on DateTime, provided by the DateTimeX extension
Whether this date falls on a Monday through Friday.no setter - isWeekend → bool
-
Available on DateTime, provided by the DateTimeX extension
Whether this date falls on a Saturday or Sunday.no setter - isYesterday → bool
-
Available on DateTime, provided by the DateTimeX extension
Whether this date fell on yesterday's calendar date.no setter - nextDay → DateTime
-
Available on DateTime, provided by the DateTimeX extension
Returns the next calendar day at 00:00:00.no setter - previousDay → DateTime
-
Available on DateTime, provided by the DateTimeX extension
Returns the previous calendar day at 00:00:00.no setter - quarter → int
-
Available on DateTime, provided by the DateTimeX extension
Calendar quarter, 1 through 4.no setter - startOfDay → DateTime
-
Available on DateTime, provided by the DateTimeX extension
Returns the start of the calendar day (00:00:00.000000).no setter - startOfHour → DateTime
-
Available on DateTime, provided by the DateTimeX extension
Start of the hour (minutes and below zeroed).no setter - startOfMinute → DateTime
-
Available on DateTime, provided by the DateTimeX extension
Start of the minute (seconds and below zeroed).no setter - startOfMonth → DateTime
-
Available on DateTime, provided by the DateTimeX extension
Returns the start of the month (1st day at 00:00:00.000000).no setter - startOfQuarter → DateTime
-
Available on DateTime, provided by the DateTimeX extension
Start of the calendar quarter.no setter - startOfYear → DateTime
-
Available on DateTime, provided by the DateTimeX extension
Start of the year (January 1st at00:00:00.000000).no setter - weekOfYear → int
-
Available on DateTime, provided by the DateTimeX extension
ISO 8601 week number (1 through 53).no setter
Methods
-
addBusinessDays(
int days) → DateTime -
Available on DateTime, provided by the DateTimeX extension
Advances bydaysweekdays, skipping weekends. -
addMonths(
int months) → DateTime -
Available on DateTime, provided by the DateTimeX extension
Addsmonths, clamping the day to the target month's length. -
addYears(
int years) → DateTime -
Available on DateTime, provided by the DateTimeX extension
Addsyears, clamping Feb 29 to Feb 28 in non-leap years. -
age(
{DateTime? at}) → int -
Available on DateTime, provided by the DateTimeX extension
Calculates age in complete years relative toat(defaults to now). -
businessDaysUntil(
DateTime other) → int -
Available on DateTime, provided by the DateTimeX extension
Weekdays (Mon–Fri) between this date andother, excluding this date and includingother. Negative whenotheris earlier. -
daysUntil(
DateTime other) → int -
Available on DateTime, provided by the DateTimeX extension
Whole calendar days from this date toother. Negative whenotheris earlier. -
endOfWeek(
{int firstDayOfWeek = DateTime.monday}) → DateTime - Returns the end of the week given a starting weekday (default Monday).
-
isSameDay(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeX extension
Checks if this date has the same year, month, and day asother. -
isSameMonth(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeX extension
Whether this date shares the same year and month asother. -
isSameWeek(
DateTime other, {int firstDayOfWeek = DateTime.monday}) → bool -
Available on DateTime, provided by the DateTimeX extension
Whether this date falls in the same week asother. -
isSameYear(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeX extension
Whether this date shares the same year asother. -
nextWeekday(
int weekday) → DateTime -
Available on DateTime, provided by the DateTimeX extension
The next occurrence ofweekday(DateTime.monday…DateTime.sunday), always strictly after this date. -
previousWeekday(
int weekday) → DateTime -
Available on DateTime, provided by the DateTimeX extension
The previous occurrence ofweekday, always strictly before this date. -
startOfWeek(
{int firstDayOfWeek = DateTime.monday}) → DateTime - Returns the start of the week given a starting weekday (default Monday).
-
subtractMonths(
int months) → DateTime -
Available on DateTime, provided by the DateTimeX extension
Subtractsmonths, clamping the day to the target month's length. -
subtractYears(
int years) → DateTime -
Available on DateTime, provided by the DateTimeX extension
Subtractsyears, clamping Feb 29 to Feb 28 in non-leap years. -
toDateString(
) → String -
Available on DateTime, provided by the DateTimeX extension
yyyy-MM-dd. -
toDateTimeString(
{bool withSeconds = true}) → String -
Available on DateTime, provided by the DateTimeX extension
yyyy-MM-dd HH:mm:ss. -
toRelativeString(
{DateTime? clock}) → String -
Available on DateTime, provided by the DateTimeX extension
Coarse relative description such as'3 days ago'or'in an hour'. -
toTimeString(
{bool withSeconds = true}) → String -
Available on DateTime, provided by the DateTimeX extension
HH:mmorHH:mm:ss.