DateTimeUtils class
Utils to work with DateTime.
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
-
addDays(
DateTime date, int days) → DateTime - Returns the DateTime resulting from adding the given number of days to this DateTime.
-
addMonths(
DateTime date, int months) → DateTime - Returns the DateTime resulting from adding the given number of months to this DateTime.
-
addWeeks(
DateTime date, int weeks) → DateTime - Returns the DateTime resulting from adding the given number of weeks to this DateTime.
-
addYears(
DateTime date, int years) → DateTime - Returns the DateTime resulting from adding the given number of years to this DateTime.
-
copyWith(
DateTime date, {int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond}) → DateTime -
Creates a copy of
date
but with the given fields replaced with the new values. -
firstDayOfFirstWeek(
int year, {int? firstWeekday}) → DateTime -
Returns start of the first day of the first week in
year
. -
firstDayOfMonth(
DateTime date) → DateTime -
Returns DateTime that represents a beginning
of the first day of the month containing
date
. -
firstDayOfNextMonth(
DateTime dateTime) → DateTime - Returns DateTime that represents a beginning of the first day of the next month.
-
firstDayOfNextWeek(
DateTime dateTime, {int? firstWeekday}) → DateTime -
Returns start of the first day of the next week for specified
dateTime
. -
firstDayOfNextYear(
DateTime dateTime) → DateTime - Returns DateTime that represents a beginning of the first day of the next year.
-
firstDayOfWeek(
DateTime dateTime, {int? firstWeekday}) → DateTime -
Returns start of the first day of the week for specified
dateTime
. -
firstDayOfYear(
DateTime dateTime) → DateTime -
Returns DateTime that represents a beginning
of the first day of the year containing
date
. -
generateWithDayStep(
DateTime start, DateTime end) → Iterable< DateTime> -
Returns an iterable of
DateTime
with 1 day step in given range. -
getDayNumberInWeek(
DateTime date, {int? firstWeekday}) → int - Returns number of the day in week (starting with 1).
-
getDayNumberInYear(
DateTime date) → int - Returns number of the day in year.
-
getDaysDifference(
DateTime a, DateTime b) → int - Returns count of days between two dates.
-
getDaysInMonth(
int year, int monthNum) → int -
Returns number of days in the
month
of theyear
. -
getDaysInYear(
int year) → int - Returns the number of days in a given year.
-
getLastWeekNumber(
int year, {int? firstWeekday}) → int -
Returns number of the last week in
year
. -
getWeekNumber(
DateTime date, {int? firstWeekday}) → int - Returns week number in year.
-
isCurrentDate(
DateTime date) → bool - Проверяет является ли заданная дата текущей.
-
isFirstDayOfMonth(
DateTime day) → bool -
Checks if
day
is in the first day of a month. -
isFirstDayOfWeek(
DateTime day, {int? firstWeekday}) → bool -
Checks if
day
is in the first day of a week. -
isLastDayOfMonth(
DateTime day) → bool -
Checks if
day
is in the last day of a month. -
isLastDayOfWeek(
DateTime day, {int? firstWeekday}) → bool -
Checks if
day
is in the last day of a week. -
isSameDay(
DateTime a, DateTime b) → bool -
Check if
a
andb
are on the same day. -
isWeekInYear(
DateTime date, int year, int? firstWeekday) → bool -
Checks if week, that contains
date
is inyear
. -
lastDayOfMonth(
DateTime dateTime) → DateTime -
Returns DateTime that represents a beginning
of the last day of the month containing
date
. -
lastDayOfWeek(
DateTime dateTime, {int? firstWeekday}) → DateTime -
Returns start of the last day of the week for specified
dateTime
. -
lastDayOfYear(
DateTime dateTime) → DateTime -
Returns DateTime that represents a beginning
of the last day of the year containing
date
. -
max(
DateTime a, DateTime b) → DateTime - Returns the latest of two dates.
-
min(
DateTime a, DateTime b) → DateTime - Returns the earliest of two dates.
-
nextDay(
DateTime d) → DateTime - Returns same time in the next day.
-
nextMonth(
DateTime date) → int - Returns a number of the next month.
-
nextYear(
DateTime d) → DateTime - Returns same date in the next year.
-
now(
) → DateTime - Returns current time.
-
previousDay(
DateTime d) → DateTime - Returns same time in the previous day.
-
previousYear(
DateTime d) → DateTime - Returns same date in the previous year.
-
setTime(
DateTime date, int hours, int minutes, [int seconds = 0, int milliseconds = 0, int microseconds = 0]) → DateTime -
Creates a copy of
date
but with time replaced with the new values. -
startOfDay(
DateTime dateTime) → DateTime - Returns DateTime for the beginning of the day (00:00:00).
-
startOfNextDay(
DateTime dateTime) → DateTime - Returns DateTime for the beginning of the next day (00:00:00).
-
startOfToday(
) → DateTime - Returns DateTime for the beginning of today (00:00:00).