DateTimeExtensions extension
Extension methods for the DateTime
class.
This extension provides various utility methods to manipulate and format DateTime
objects.
It includes methods to find the next day of the week, get the first and last day of the week, month, and year,
calculate the first and last day of a fortnight, quarter, bimester, and semester,
check if a date is the same as today, yesterday, or tomorrow,
get the beginning and end of a day, format the date and time in a readable format,
calculate the time difference between two dates, determine the time of day, and more.
- on
Properties
- beginOfDay → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the beginning of the day.no setter - bimesterNumber → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the bimester number.no setter - dayOfYear → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Get Day Of Yearno setter - endOfDay → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the end of the day.no setter - firstDayOfBimester → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the first day of the bimester.no setter - firstDayOfFortnight → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the first day of the fortnight.no setter - firstDayOfMonth → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the first day of the month for the given date.no setter - firstDayOfQuarter → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the first day of the quarter.no setter - firstDayOfSemester → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the first day of the semester.no setter - firstDayOfWeek → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the first day of the week for the given date.no setter - firstDayOfYear → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the first day of the year for the given date.no setter - fortnightNumber → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the fortnight number.no setter - fromNow → Duration
-
Available on DateTime, provided by the DateTimeExtensions extension
Extension method to calculate the duration from the current date and time to the given date and time.no setter -
healthMonthColors
→ Iterable<
Color> -
Available on DateTime, provided by the DateTimeExtensions extension
no setter - isLeapYear → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Check if this year is a Leap Yearno setter - isToday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Checks if the date is today.no setter - isTomorrow → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Checks if the date is tomorrow.no setter - isYesterday → bool
-
Available on DateTime, provided by the DateTimeExtensions extension
Checks if the date is yesterday.no setter - lastDayOfBimester → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the last day of the bimester.no setter - lastDayOfFortnight → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the last day of the fortnight.no setter - lastDayOfMonth → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the last day of the month for the given date.no setter - lastDayOfQuarter → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the last day of the quarter.no setter - lastDayOfSemester → DateTime
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the last day of the semester.no setter - lastDayOfWeek → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the last day of the week for the given date.no setter - lastDayOfYear → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the last day of the year for the given date.no setter - nextBimester → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the next bimesterno setter - nextFortnight → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Return the next fortnightno setter - nextMonth → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the next month.no setter - nextQuarter → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the next quarter.no setter - nextSemester → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the next semester.no setter - nextWeek → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the next week.no setter - nextYear → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the next year.no setter - percentageOfDay → double
-
Available on DateTime, provided by the DateTimeExtensions extension
Get current percentage of the day Returns the percentage of the day that has passedno setter - percentageOfYear → double
-
Available on DateTime, provided by the DateTimeExtensions extension
Get current percentage of the yearno setter - previousBimester → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the previous bimesterno setter - previousFortnight → date
-
Available on DateTime, provided by the DateTimeExtensions extension
no setter - previousMonth → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the previous month.no setter - previousQuarter → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the previous quarter.no setter - previousSemester → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the previous semesterno setter - previousWeek → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the previous week.no setter - previousYear → date
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the previous year.no setter - quarterNumber → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the quarter number.no setter - readableTime → String
-
Available on DateTime, provided by the DateTimeExtensions extension
Readable Timeno setter -
seasonColors
→ Iterable<
NamedColors> -
Available on DateTime, provided by the DateTimeExtensions extension
no setter - semesterNumber → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Returns the semester number.no setter - timeFormat → String
-
Available on DateTime, provided by the DateTimeExtensions extension
Time Formatno setter - timeOfDayEmoji → String
-
Available on DateTime, provided by the DateTimeExtensions extension
Time Of Day Emojino setter - weekOfYear → int
-
Available on DateTime, provided by the DateTimeExtensions extension
Get Week Of Yearno setter
Methods
-
at(
{int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond}) → date -
Available on DateTime, provided by the DateTimeExtensions extension
Returns a DateTime object representing the specified date and time. -
describe(
{string yesterday = "Yesterday", dynamic locale}) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Describe -
findNextDayOfWeek(
int weekday) → date -
Available on DateTime, provided by the DateTimeExtensions extension
Returns the next day of the week from the given date. -
firstDayOfMonthGroup(
int group) → date -
Available on DateTime, provided by the DateTimeExtensions extension
Returns the first day of the month group. -
firstMonthOfGroup(
int group) → int -
Available on DateTime, provided by the DateTimeExtensions extension
Returns the first month of the group. -
format(
[String? format, String? locale]) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Format the date using the specified format and locale. -
healthMonthGradient(
{AlignmentGeometry begin = Alignment.topCenter, AlignmentGeometry end = Alignment.bottomCenter, List< double> ? stops, TileMode tileMode = TileMode.clamp, GradientTransform? transform}) → Gradient -
Available on DateTime, provided by the DateTimeExtensions extension
-
isBetween(
DateTime start, DateTime end) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if the current date is between the specified start and end dates (exclusive). -
isBetweenOrEqual(
DateTime start, DateTime end) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if the current DateTime object is between or equal to the given start and end DateTime objects. -
isSameDate(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if the date is the same as the specifiedother
date, ignoring time. -
isSameMonthYear(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
-
lastDayOfMonthGroup(
int group) → date -
Available on DateTime, provided by the DateTimeExtensions extension
Returns the last day of the month group. -
lastMonthOfGroup(
int group) → int -
Available on DateTime, provided by the DateTimeExtensions extension
Returns the last month of the group. -
monthGradient(
{AlignmentGeometry begin = Alignment.topCenter, AlignmentGeometry end = Alignment.bottomCenter, List< double> ? stops, TileMode tileMode = TileMode.clamp, GradientTransform? transform}) → Gradient -
Available on DateTime, provided by the DateTimeExtensions extension
-
monthGroupNumber(
int group) → int -
Available on DateTime, provided by the DateTimeExtensions extension
Returns the month group number. -
monthName(
[string? locale]) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Get Month -
readableDate(
[string? locale]) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Readable Date -
readableDateTime(
[dynamic locale]) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Readable DateTime -
readableDateTimeFormat(
[dynamic locale]) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Readable Date Time Format -
shortMonthName(
[dynamic locale]) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Get Short Month -
shortWeekday(
[dynamic locale]) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Get Short Day -
sum(
{int years = 0, int months = 0, int days = 0, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0, int microseconds = 0}) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Returns a new DateTime object by adding the specified amount of time to the current date and time. -
timeAgo(
{string remaining = "remaining", string day = "d", string hour = "h", string minute = "m", string seconds = "s", string justNow = "Just now", date? until}) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Time Ago -
timeOfDay(
{string? morning, string? afternoon, string? evening, string? night}) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Time Of Day -
toRange(
[DateTime? endDate]) → DateRange -
Available on DateTime, provided by the DateTimeExtensions extension
Converts the current date to a DateRange object with the specifiedendDate
. -
weekDayName(
[dynamic locale]) → String -
Available on DateTime, provided by the DateTimeExtensions extension
Get Day
Operators
-
operator +(
Duration other) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Adds the given duration to the current date and time. -
operator -(
Duration other) → DateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Subtracts the given duration from the current date and time. -
operator <(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if the current date and time is less than the given date and time. -
operator <=(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if the current date and time is less than or equal to the given date and time. -
operator >(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if the current date and time is greater than the given date and time. -
operator >=(
DateTime other) → bool -
Available on DateTime, provided by the DateTimeExtensions extension
Checks if the current date and time is greater than or equal to the given date and time.