DateTimeExtension extension

on

Properties

clone DateTime

Available on DateTime, provided by the DateTimeExtension extension

no setter
endOfDay DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of a day for this date. The result will be in the local timezone.
no setter
endOfHour DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of the hour for this date. The result will be in the local timezone.
no setter
endOfISOWeek DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of ISO week for this date. The result will be in the local timezone.
no setter
endOfMinute DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of the minute for this date. The result will be in the local timezone.
no setter
endOfMonth DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of the month for this date. The result will be in the local timezone.
no setter
endOfQuarter DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of quarter for this date. The result will be in the local timezone.
no setter
endOfSecond DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of the second for this date. The result will be in the local timezone.
no setter
endOfWeek DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of the week for this date. The result will be in the local timezone.
no setter
endOfYear DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of the year for this date. The result will be in the local timezone.
no setter
getDate int

Available on DateTime, provided by the DateTimeExtension extension

Get the day of the month of the given date. The day of the month 1..31.
no setter
getDay int

Available on DateTime, provided by the DateTimeExtension extension

Get the day of the week of the given date.
no setter
getDayOfYear int

Available on DateTime, provided by the DateTimeExtension extension

Days since year started. The result will be in the local timezone.
no setter
getDaysInMonth int

Available on DateTime, provided by the DateTimeExtension extension

Days since month started. The result will be in the local timezone.
no setter
getDaysInYear int

Available on DateTime, provided by the DateTimeExtension extension

Number of days in current year
no setter
getHours int

Available on DateTime, provided by the DateTimeExtension extension

Get the hours of the given date. The hour of the day, expressed as in a 24-hour clock 0..23.
no setter
getISOWeek int

Available on DateTime, provided by the DateTimeExtension extension

Get the ISO week index
no setter
getISOWeeksInYear int

Available on DateTime, provided by the DateTimeExtension extension

Get the number of weeks in an ISO week-numbering year
no setter
getMicroseconds int

Available on DateTime, provided by the DateTimeExtension extension

Get the microseconds of the given date. The microsecond 0...999.
no setter
getMicrosecondsSinceEpoch int

Available on DateTime, provided by the DateTimeExtension extension

Get the microseconds since the 'Unix epoch' 1970-01-01T00:00:00Z (UTC).
no setter
getMilliseconds int

Available on DateTime, provided by the DateTimeExtension extension

Get the milliseconds of the given date. The millisecond 0...999.
no setter
getMillisecondsSinceEpoch int

Available on DateTime, provided by the DateTimeExtension extension

Get the milliseconds since the 'Unix epoch' 1970-01-01T00:00:00Z (UTC).
no setter
getMinutes int

Available on DateTime, provided by the DateTimeExtension extension

Get the minutes of the given date. The minute 0...59.
no setter
getMonth int

Available on DateTime, provided by the DateTimeExtension extension

Get the month of the given date. The month 1..12.
no setter
getSeconds int

Available on DateTime, provided by the DateTimeExtension extension

Get the seconds of the given date. The second 0...59.
no setter
getTime int

Available on DateTime, provided by the DateTimeExtension extension

get the number of milliseconds since epoch
no setter
getTimeZoneName String

Available on DateTime, provided by the DateTimeExtension extension

The time zone name. This value is provided by the operating system and may be an abbreviation or a full name. In the browser or on Unix-like systems commonly returns abbreviations, such as 'CET' or 'CEST'. On Windows returns the full name, for example 'Pacific Standard Time'.
no setter
getTimeZoneOffset Duration

Available on DateTime, provided by the DateTimeExtension extension

The time zone offset, which is the difference between local time and UTC. The offset is positive for time zones east of UTC. Note, that JavaScript, Python and C return the difference between UTC and local time. Java, C# and Ruby return the difference between local time and UTC.
no setter
getWeek int

Available on DateTime, provided by the DateTimeExtension extension

Get the week index
no setter
getWeekday int

Available on DateTime, provided by the DateTimeExtension extension

The day of the week monday..sunday. In accordance with ISO 8601 a week starts with Monday, which has the value 1.
no setter
getWeekYear int

Available on DateTime, provided by the DateTimeExtension extension

Get the local week-numbering year
no setter
getYear int

Available on DateTime, provided by the DateTimeExtension extension

The year
no setter
isFirstDayOfMonth bool

Available on DateTime, provided by the DateTimeExtension extension

Is the given date the first day of a month?
no setter
isFriday bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if this date day is friday
no setter
isFuture bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if this date isAfter Date.now
no setter
isLastDayOfMonth bool

Available on DateTime, provided by the DateTimeExtension extension

Is the given date the last day of a month?
no setter
isLeapYear bool

Available on DateTime, provided by the DateTimeExtension extension

Is the given date in the leap year?
no setter
isMonday bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if this date day is monday
no setter
isPast bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if this date isBefore Date.now
no setter
isSaturday bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if this date day is saturday
no setter
isSunday bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if this date day is sunday
no setter
isThisHour bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same hour as DateTime.now
no setter
isThisMinute bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same minute as DateTime.now
no setter
isThisMonth bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same month as DateTime.now
no setter
isThisSecond bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same second as DateTime.now
no setter
isThisYear bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same year as DateTime.now
no setter
isThursday bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if this date day is thursday
no setter
isToday bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same day as DateTime.today
no setter
isTomorrow bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same day as DateTime.tomorrow
no setter
isTuesday bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if this date day is tuesday
no setter
isUTC bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if this DateTime is set as UTC.
no setter
isWednesday bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if this date day is wednesday
no setter
isWeekend bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if this DateTime is a saturday or a sunday
no setter
isYesterday bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same day as DateTime.yesterday
no setter
local DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get Local DateTime from this DateTime
no setter
nextDay DateTime

Available on DateTime, provided by the DateTimeExtension extension

The day after The day after this DateTime
no setter
nextMonth DateTime

Available on DateTime, provided by the DateTimeExtension extension

The month after this DateTime
no setter
nextWeek DateTime

Available on DateTime, provided by the DateTimeExtension extension

The week after this DateTime
no setter
nextYear DateTime

Available on DateTime, provided by the DateTimeExtension extension

The year after this DateTime
no setter
previousDay DateTime

Available on DateTime, provided by the DateTimeExtension extension

The day previous this DateTime
no setter
previousMonth DateTime

Available on DateTime, provided by the DateTimeExtension extension

The month previous this DateTime
no setter
previousWeek DateTime

Available on DateTime, provided by the DateTimeExtension extension

The week previous this DateTime
no setter
previousYear DateTime

Available on DateTime, provided by the DateTimeExtension extension

The year previous this DateTime
no setter
secondsSinceEpoch int

Available on DateTime, provided by the DateTimeExtension extension

Number of seconds since epoch time
no setter
startOfDay DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get a DateTime representing start of Day of this DateTime in local time.
no setter
startOfHour DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get a DateTime representing start of Hour of this DateTime in local time.
no setter
startOfISOWeek DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get a DateTime representing start of week (ISO week) of this DateTime in local time.
no setter
startOfISOWeekYear DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get the start of a local week-numbering year
no setter
startOfMinute DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get a DateTime representing start of minute of this DateTime in local time.
no setter
startOfMonth DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get a DateTime representing start of month of this DateTime in local time.
no setter
startOfQuarter DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get a DateTime representing start of quarter of this DateTime in local time.
no setter
startOfSecond DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get a DateTime representing start of second of this DateTime in local time.
no setter
startOfWeek DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get a DateTime representing start of week of this DateTime in local time.
no setter
startOfWeekYear DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get the start of a local week-numbering year
no setter
startOfYear DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get a DateTime representing start of year of this DateTime in local time.
no setter
timestamp int

Available on DateTime, provided by the DateTimeExtension extension

get the number of milliseconds since epoch
no setter
toLocalTime DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get Date object in LocalTime of current object.
no setter
toUTC DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get Date object as UTC of current object.
no setter
utc DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get UTC DateTime from this DateTime
no setter

Methods

addDays(int amount, [bool ignoreDaylightSavings = false]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Add a certain amount of days to this date
addHours(int amount, [bool ignoreDaylightSavings = false]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Add a certain amount of hours to this date
addMicroseconds(int amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Add a certain amount of microseconds to this date
addMilliseconds(int amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Add a certain amount of milliseconds to this date
addMinutes(int amount, [bool ignoreDaylightSavings = false]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Add a certain amount of minutes to this date
addMonths(int amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Add a certain amount of months to this date
addQuarters(int amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Add a certain amount of quarters to this date
addSeconds(int amount, [bool ignoreDaylightSavings = false]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Add a certain amount of seconds to this date
addWeeks(int amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Add a certain amount of weeks to this date
addYears(int amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Add a certain amount of years to this date
closestIndexTo(Iterable<DateTime> datesArray) int?

Available on DateTime, provided by the DateTimeExtension extension

Get index of the closest day to current one, returns null if empty Iterable is passed as argument
closestTo(Iterable<DateTime> datesArray) DateTime?

Available on DateTime, provided by the DateTimeExtension extension

Get closest day to current one, returns null if empty Iterable is passed as argument
compare(DateTime other) int

Available on DateTime, provided by the DateTimeExtension extension

Compares this Date object to other, returning zero if the values are equal. Returns a negative value if this Date isBefore other. It returns 0 if it isAtSameMomentAs other, and returns a positive value otherwise (when this isAfter other).
diff(DateTime other) Duration

Available on DateTime, provided by the DateTimeExtension extension

Get the difference between this data and other date as a Duration
differenceInDays(DateTime other) int

Available on DateTime, provided by the DateTimeExtension extension

Difference in days between this date and other
differenceInHours(DateTime other) int

Available on DateTime, provided by the DateTimeExtension extension

Difference in hours between this date and other
differenceInMicroseconds(DateTime other) int

Available on DateTime, provided by the DateTimeExtension extension

Difference in microseconds between this date and other
differenceInMilliseconds(DateTime other) int

Available on DateTime, provided by the DateTimeExtension extension

Difference in milliseconds between this date and other
differenceInMinutes(DateTime other) int

Available on DateTime, provided by the DateTimeExtension extension

Difference in minutes between this date and other
differenceInSeconds(DateTime other) int

Available on DateTime, provided by the DateTimeExtension extension

Difference in seconds between this date and other
eachDay(DateTime date, {bool ignoreDaylightSavings = false}) Iterable<DateTime>

Available on DateTime, provided by the DateTimeExtension extension

Return an Iterable of dates which is inclusive to this but exclusive to date
equals(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

format(String pattern, [String locale = 'en_US']) String

Available on DateTime, provided by the DateTimeExtension extension

Format this DateTime following the String pattern
isEqual(dynamic other) bool

Available on DateTime, provided by the DateTimeExtension extension

Check if a date is equals to other
isSameDay(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same day as other
isSameHour(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same hour as other
isSameMinute(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same minute as other
isSameMonth(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same month as other
isSameOrAfter(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if other isEqual or isAfter to this date
isSameOrBefore(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

Return true if other isEqual or isBefore to this date
isSameSecond(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same second as other
isSameYear(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

Check if this date is in the same year as other
isWithinInterval(Interval interval) bool

Available on DateTime, provided by the DateTimeExtension extension

Checks if a DateTime is within an Interval
isWithinRange(DateTime startDate, DateTime endDate) bool

Available on DateTime, provided by the DateTimeExtension extension

Checks if a DateTime is within a Rage (two dates that makes an Interval)
setDay(int day, [int? hour, int? minute, int? second, int? millisecond, int? microsecond]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Change day of this date
setHour(int hour, [int? minute, int? second, int? millisecond, int? microsecond]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Change hour of this date
setMicrosecond(int microsecond) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Change microsecond of this date
setMillisecond(int millisecond, [int? microsecond]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Change millisecond of this date
setMinute(int minute, [int? second, int? millisecond, int? microsecond]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Change minute of this date
setMonth(int month, [int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Change month of this date
setSecond(int second, [int? millisecond, int? microsecond]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Change second of this date
setWeekDay(int weekday, [int weekStartsOn = DateTime.sunday]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Change weekday of this date
setYear(int year, [int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Change year of this date
sub(Duration duration) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Subtracts a Duration from this DateTime
subDays(int amount, [bool ignoreDaylightSavings = false]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Subtracts an amount of days from this DateTime
subHours(int amount, [bool ignoreDaylightSavings = false]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Subtracts an amount of hours from this DateTime
subMicroseconds(dynamic amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Subtracts an amount of microseconds from this DateTime
subMilliseconds(dynamic amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Subtracts an amount of milliseconds from this DateTime
subMinutes(dynamic amount, [bool ignoreDaylightSavings = false]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Subtracts an amount of minutes from this DateTime
subMonths(dynamic amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Subtracts an amount of months from this DateTime
subSeconds(dynamic amount, [bool ignoreDaylightSavings = false]) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Subtracts an amount of seconds from this DateTime
subtract(Duration duration) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Subtract a Duration to this date
subYears(dynamic amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Subtracts an amount of years from this DateTime
timeago({String? locale, DateTime? clock, bool? allowFromNow}) String

Available on DateTime, provided by the DateTimeExtension extension

Formats provided date to a fuzzy time like 'a moment ago' (use timeago package to change locales)
toHumanString() String

Available on DateTime, provided by the DateTimeExtension extension

Operators

operator +(Duration other) DateTime

Available on DateTime, provided by the DateTimeExtension extension

operator -(Duration other) DateTime

Available on DateTime, provided by the DateTimeExtension extension

operator <(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

operator <=(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

operator >(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

operator >=(DateTime other) bool

Available on DateTime, provided by the DateTimeExtension extension

Static Properties

endOfToday DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of today. The result will be in the local timezone.
no setter
endOfTomorrow DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of tomorrow. The result will be in the local timezone.
no setter
endOfYesterday DateTime

Available on DateTime, provided by the DateTimeExtension extension

Return the end of yesterday. The result will be in the local timezone.
no setter
startOfToday DateTime

Available on DateTime, provided by the DateTimeExtension extension

Get a DateTime representing start of today of DateTime.today in local time.
no setter
today DateTime

Available on DateTime, provided by the DateTimeExtension extension

Current date (Same as Date.now)
no setter
tomorrow DateTime

Available on DateTime, provided by the DateTimeExtension extension

Tomorrow at same hour / minute / second as now
no setter
yesterday DateTime

Available on DateTime, provided by the DateTimeExtension extension

Yesterday at same hour / minute / second as now
no setter

Static Methods

areRangesOverlapping(DateTime initialRangeStartDate, DateTime initialRangeEndDate, DateTime comparedRangeStartDate, DateTime comparedRangeEndDate) bool

Available on DateTime, provided by the DateTimeExtension extension

Know if two ranges of dates overlaps
compareAsc(DateTime dateLeft, DateTime dateRight) int

Available on DateTime, provided by the DateTimeExtension extension

Compare the two dates and return 1 if the first date isAfter the second, -1 if the first date isBefore the second or 0 first date isEqual the second.
compareDesc(DateTime dateLeft, DateTime dateRight) int

Available on DateTime, provided by the DateTimeExtension extension

Compare the two dates and return -1 if the first date isAfter the second, 1 if the first date isBefore the second or 0 first date isEqual the second.
fromSecondsSinceEpoch(int secondsSinceEpoch, {bool isUtc = false}) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Number of seconds since epoch time / A.K.A Unix timestamp
isDate(dynamic argument) bool

Available on DateTime, provided by the DateTimeExtension extension

Check if a Object if a DateTime, use for validation purposes
max(DateTime left, DateTime right) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns true if left isAfter right
min(DateTime left, DateTime right) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns true if left isBefore right
parse(String dateString, {String? pattern, String locale = 'en_US', bool isUTC = false}) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Transforms a date that follows a pattern from a String representation to a DateTime object
unix(int seconds) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Create a Date object from a Unix timestamp