DateTimeExtensions extension

Extensions for DateTime

on

Properties

endOfDay DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns a new DateTime with the time set to the end of the day (23:59:59.999).
no setter
endOfMonth DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns a new DateTime with the time set to the end of the month.
no setter
isAm bool

Available on DateTime, provided by the DateTimeExtensions extension

Check if the time is AM
no setter
isInTheFuture bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is in the future
no setter
isInThePast bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is in the past
no setter
isInThisMonth bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is in the same month as the given date
no setter
isInThisYear bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is in the same year as the given date
no setter
isLeapYear bool

Available on DateTime, provided by the DateTimeExtensions extension

returns true if date year is leap year
no setter
isToday bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is today
no setter
isTomorrow bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is tomorrow
no setter
isYesterday bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is yesterday
no setter
nextDay DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Return new instance of DateTime with the next day date
no setter
nextMonth DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Return new instance of DateTime with the next month date
no setter
previousDay DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Return new instance of DateTime with the previous day date
no setter
previousMonth DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Return new instance of DateTime with the previous month date
no setter
sameDayNextWeek DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Return new instance of DateTime with the next week date
no setter
sameDayPreviousWeek DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Return new instance of DateTime with the previous week date
no setter
startOfDay DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns a new DateTime with the time set to the start of the day (00:00:00.000). This is functionally equivalent to withoutTime.
no setter
startOfMonth DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns a new DateTime with the time set to the start of the month.
no setter

Methods

copyWith({int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond}) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Creates new instance of DateTime with the same date But overrides the values of the given parameters
dayOfTheWeek() Weekday

Available on DateTime, provided by the DateTimeExtensions extension

Returns the day of the week
dayOfTheWeekIndex({Weekday firstDay = Weekday.monday}) int

Available on DateTime, provided by the DateTimeExtensions extension

Returns the index of the day of the week With the given firstDay as the first day of the week
endOfWeek({Weekday firstDay = Weekday.monday}) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns a new DateTime with the time set to the end of the week.
isInThisWeek({Weekday firstDay = Weekday.monday}) bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is in the same week as the given date
isSameDay(DateTime date) bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is in the same day as the given date
isSameMonth(DateTime date) bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is in the same month as the given date
isSameWeek({required DateTime date, Weekday firstDay = Weekday.monday}) bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is in the same week as the given date
isSameYear(DateTime date) bool

Available on DateTime, provided by the DateTimeExtensions extension

Checks whether the date is in the same year as the given date
monthOfTheYear() Month

Available on DateTime, provided by the DateTimeExtensions extension

Returns the month of the given date.
startOfWeek({Weekday firstDay = Weekday.monday}) DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns a new DateTime with the time set to the start of the week.
withoutTime() DateTime

Available on DateTime, provided by the DateTimeExtensions extension

Returns new DateTime without the time part for example => 2020-01-01T12:51:42.325 to => 2020-01-01T00:00:00.000