DateTimeExtensions extension
Extensions for DateTime
- on
Properties
- isAm → bool
-
Check if the time is AM
no setter
- isInTheFuture → bool
-
Checks whether the date is in the future
no setter
- isInThePast → bool
-
Checks whether the date is in the past
no setter
- isInThisMonth → bool
-
Checks whether the date is in the same month as the given
date
no setter - isInThisYear → bool
-
Checks whether the date is in the same year as the given
date
no setter - isLeapYear → bool
-
returns true if date year is leap year
no setter
- isToday → bool
-
Checks whether the date is today
no setter
- isTomorrow → bool
-
Checks whether the date is tomorrow
no setter
- isYesterday → bool
-
Checks whether the date is yesterday
no setter
- nextDay → DateTime
-
Return new instance of DateTime with the next day date
no setter
- nextMonth → DateTime
-
Return new instance of DateTime with the next month date
no setter
- previousDay → DateTime
-
Return new instance of DateTime with the previous day date
no setter
- previousMonth → DateTime
-
Return new instance of DateTime with the previous month date
no setter
- sameDayNextWeek → DateTime
-
Return new instance of DateTime with the next week date
no setter
- sameDayPreviousWeek → DateTime
-
Return new instance of DateTime with the previous week date
no setter
Methods
-
copyWith(
{int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond}) → DateTime - Creates new instance of DateTime with the same date But overrides the values of the given parameters
-
dayOfTheWeek(
) → Weekday - Returns the day of the week
-
dayOfTheWeekIndex(
{Weekday firstDay = Weekday.monday}) → int -
Returns the index of the day of the week
With the given
firstDay
as the first day of the week -
isInThisWeek(
{Weekday firstDay = Weekday.monday}) → bool -
Checks whether the date is in the same week as the given
date
-
isSameDay(
DateTime date) → bool -
Checks whether the date is in the same day as the given
date
-
isSameMonth(
DateTime date) → bool -
Checks whether the date is in the same month as the given
date
-
isSameWeek(
{required DateTime date, Weekday firstDay = Weekday.monday}) → bool -
Checks whether the date is in the same week as the given
date
-
isSameYear(
DateTime date) → bool -
Checks whether the date is in the same year as the given
date
-
monthOfTheYear(
) → Month - Returns the month of the given date.
-
withoutTime(
) → DateTime -
Returns new DateTime without the time part
for example =>
2020-01-01T12:51:42.325
to =>2020-01-01T00:00:00.000