DateTimeExtensions extension
Utility extensions for DateTime to provide common formatting and calculation methods used in Flutter apps.
- on
Properties
- ageInYears → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the age in years from this date to now.no setter - daysFromNow → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the number of days from this date to now.no setter - daysInMonth → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the number of days in the current month.no setter - daysToNow → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the number of days from now to this date.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 (last day 23:59:59.999).no setter - endOfWeek → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the end of the week (Sunday 23:59:59.999).no setter - endOfYear → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the end of the year (December 31st 23:59:59.999).no setter - isAM → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if the time is in AM (before noon).no setter - isLeapYear → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this year is a leap year.no setter - isPM → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if the time is in PM (noon or after).no setter - isThisMonth → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if the date is in the current month.no setter - isThisWeek → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if the date is in the current week.no setter - isThisYear → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if the date is in the current year.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 - isWeekday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if the date is a weekday (Monday to Friday).no setter - isWeekend → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if the date is a weekend (Saturday or Sunday).no setter - isYesterday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if the date is yesterday.no setter - monthName → String
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the name of the month (e.g., "January", "February").no setter - monthNameShort → String
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the short name of the month (e.g., "Jan", "Feb").no setter - quarter → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the quarter of the year (1-4).no setter - relativeTime → String
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns a relative time string like "2 hours ago", "tomorrow", etc.no setter - startOfDay → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the start of the day (00:00:00).no setter - startOfMonth → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the start of the month (first day 00:00:00).no setter - startOfWeek → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the start of the week (Monday 00:00:00).no setter - startOfYear → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the start of the year (January 1st 00:00:00).no setter - weekdayName → String
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the name of the weekday (e.g., "Monday", "Tuesday").no setter - weekdayNameShort → String
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the short name of the weekday (e.g., "Mon", "Tue").no setter
Methods
-
addDays(
int days) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Adds the specified number of days to this date. -
addMonths(
int months) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Adds the specified number of months to this date. -
addYears(
int years) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Adds the specified number of years to this date. -
isSameDay(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is the same day as the other date. -
isSameMonth(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is in the same month as the other date. -
isSameWeek(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is in the same week as the other date. -
isSameYear(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Returns true if this date is in the same year as the other date. -
subtractDays(
int days) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Subtracts the specified number of days from this date. -
subtractMonths(
int months) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Subtracts the specified number of months from this date. -
subtractYears(
int years) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Subtracts the specified number of years from this date. -
to12Hour(
) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Converts time to 12-hour format with AM/PM. Example: DateTime(2023, 1, 1, 14, 30).to12Hour() returns "2:30 PM" -
toDateISO(
) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Converts date to YYYY-MM-DD string (ISO format). Example: DateTime(2023, 1, 1).toDateISO() returns "2023-01-01" -
toDateString(
) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Converts date to DD/MM/YYYY string. Example: DateTime(2023, 1, 1).toDateString() returns "01/01/2023" -
toDateTimeFull(
) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Converts datetime to DD/MM/YYYY HH:MM:SS string. Example: DateTime(2023, 1, 1, 9, 5, 3).toDateTimeFull() returns "01/01/2023 09:05:03" -
toDateTimeString(
) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Converts datetime to DD/MM/YYYY HH:MM string. Example: DateTime(2023, 1, 1, 9, 5).toDateTimeString() returns "01/01/2023 09:05" -
toDateUS(
) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Converts date to MM/DD/YYYY string (US format). Example: DateTime(2023, 1, 1).toDateUS() returns "01/01/2023" -
toTimeShort(
) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Converts time to HH:MM string with leading zeros. Example: DateTime(2023, 1, 1, 9, 5).toTimeShort() returns "09:05" -
toTimeString(
) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Converts time to HH:MM:SS string with leading zeros. Example: DateTime(2023, 1, 1, 9, 5, 3).toTimeString() returns "09:05:03"