MyDateUtility class sealed
Utility functions for working with dates.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
addDaysToDate(
DateTime date, int days) → DateTime - Returns a DateTime with the added number of days and time set to midnight.
-
addMonthsToMonthDate(
DateTime monthDate, int monthsToAdd) → DateTime -
Returns a DateTime that is
monthDatewith the added number of months and the day set to 1 and time set to midnight. -
dateOnly(
DateTime date) → DateTime - Returns a DateTime with the date of the original, but time set to midnight.
-
getDaysInMonth(
int year, int month) → int - Returns the number of days in a month, according to the proleptic Gregorian calendar.
-
initializeFormatting(
) → Future< void> -
This should be called before using any other locale than the default,
en_USone. It sets up the lookup for date symbols. The data for all locales is directly available. -
initializeFormattingFromFile(
String locale, String path) → Future< void> -
This should be called for at least one
localebefore any date formatting methods are called. It sets up the lookup for date symbols usingpath. Thepathparameter should end with a directory separator appropriate for the platform. -
initializeFormattingFromUrl(
String locale, String url) → Future< void> -
This should be called for at least one locale before any date formatting
methods are called. It sets up the lookup for date symbols using
url. Theurlparameter should end with a "/". For example, "http://localhost:8000/dates/" -
isSameDay(
DateTime? dateA, DateTime? dateB) → bool - Returns true if the two DateTime objects have the same day, month, and year, or are both null.
-
isSameMonth(
DateTime? dateA, DateTime? dateB) → bool - Returns true if the two DateTime objects have the same month and year, or are both null.
-
monthDelta(
DateTime startDate, DateTime endDate) → int - Determines the number of months between two DateTime objects.