DateExtension extension
Extensions for adding additional functionality to the DateTime.
- on
Properties
- dateOnly → DateTime
-
Returns a DateTime with the date of the original, but time set to midnight.
no setter
-
daysInMonth
→ List<
DateTime> -
The list of days in a given month
no setter
- firstDayOfMonth → DateTime
-
Returns a DateTime instance representing the first day of the month of this DateTime.
no setter
- firstDayOfWeek → DateTime
-
Returns a DateTime instance representing the first day of the week of this DateTime.
no setter
- isFirstDayOfMonth → bool
-
Checks if this DateTime instance represents the first day of the month.
no setter
- isLastDayOfMonth → bool
-
Checks if this DateTime instance represents the last day of the month.
no setter
- isToday → bool
-
Returns
true
if the date is on the same day as today; otherwise,false
.no setter - isTomorrow → bool
-
Returns
true
if the date will be on the same day as tomorrow; otherwise,false
.no setter - isYesterday → bool
-
Returns
true
if the date was on the same day as yesterday; otherwise,false
.no setter - lastDayOfMonth → DateTime
-
Returns a DateTime instance representing the last day of the month of this DateTime.
no setter
- lastDayOfWeek → DateTime
-
Returns a DateTime instance representing the last day of the week of this DateTime.
no setter
- nextDay → DateTime
-
Returns a DateTime representing the day after this DateTime.
no setter
- nextMonth → DateTime
-
Returns a DateTime instance representing the exact date of the next coming month.
no setter
- nextWeek → DateTime
-
Returns a DateTime instance representing the exact date of the coming week.
no setter
- previousDay → DateTime
-
Returns a DateTime representing the day before this DateTime.
no setter
- previousMonth → DateTime
-
Returns a DateTime instance representing the exact date of the previous month.
no setter
- previousWeek → DateTime
-
Returns a DateTime instance representing the exact date of the previous week.
no setter
Methods
-
addDays(
int amount) → DateTime - Adds a certain amount of days to this date and returns a new DateTime instance.
-
addHours(
int amount) → DateTime - Adds a certain amount of hours to this date and returns a new DateTime instance.
-
diffDays(
DateTime b) → int - Returns the difference in days between two DateTime instances.
-
diffHours(
DateTime b) → int - Returns the difference in hours between two DateTime instances.
-
diffMinutes(
DateTime b) → int - Returns the difference in minutes between two DateTime instances.
-
diffSeconds(
DateTime b) → int - Returns the difference in seconds between two DateTime instances.
-
diffYearsMonthsDays(
DateTime b, {bool abbr = false}) → String -
Get the difference between two
DateTime
instances in years, months, and days. -
format(
String pattern) → String - Formats the date and time according to the specified pattern.
-
isSameDay(
DateTime b) → bool - Checks whether two DateTime instances are on the same day.
-
isSameWeek(
DateTime b) → bool - Checks if two DateTime instances fall within the same week.