DateTimes extension
Provides functions for working with in-built DateTimes.
These functions should only be used when it is not feasible to use sugar.time.
- on
Properties
- dayOfYear → int
-
Available on DateTime, provided by the DateTimes extension
The ordinal day of the year.no setter - daysInMonth → int
-
Available on DateTime, provided by the DateTimes extension
The number of days in the month, taking leap years into account.no setter - daysSinceEpoch → int
-
Available on DateTime, provided by the DateTimes extension
The days since Unix epoch.no setter - firstDayOfMonth → DateTime
-
Available on DateTime, provided by the DateTimes extension
The first day of the month.no setter - firstDayOfWeek → DateTime
-
Available on DateTime, provided by the DateTimes extension
The first day of the week.no setter - lastDayOfMonth → DateTime
-
Available on DateTime, provided by the DateTimes extension
The last day of the month.no setter - lastDayOfWeek → DateTime
-
Available on DateTime, provided by the DateTimes extension
The last day of the week.no setter - leapYear → bool
-
Available on DateTime, provided by the DateTimes extension
Whether the is year is a leap year.no setter - microsecondsSinceMidnight → int
-
Available on DateTime, provided by the DateTimes extension
The time as microseconds since midnight.no setter - millisecondsSinceMidnight → int
-
Available on DateTime, provided by the DateTimes extension
The time as milliseconds since midnight.no setter - offset → Offset
-
Available on DateTime, provided by the DateTimes extension
The offset.no setter - weekOfYear → int
-
Available on DateTime, provided by the DateTimes extension
The ordinal week of the year.no setter
Methods
-
ceil(
TemporalUnit unit, int value) → DateTime -
Available on DateTime, provided by the DateTimes extension
Returns a copy of this ceiled to the nearestunitandvalue. -
floor(
TemporalUnit unit, int value) → DateTime -
Available on DateTime, provided by the DateTimes extension
Returns a copy of this floored to the nearestunitandvalue. -
minus(
{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 - Returns a copy of this with the units of time subtracted.
-
plus(
{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 - Returns a copy of this with the units of time added.
-
round(
TemporalUnit unit, int value) → DateTime -
Available on DateTime, provided by the DateTimes extension
Returns a copy of this rounded to the nearestunitandvalue. -
toDateString(
) → String -
Available on DateTime, provided by the DateTimes extension
Formats this DateTime's date as a ISO-8601 date, ignoring the time. -
toLocalDate(
) → LocalDate -
Available on DateTime, provided by the DateTimes extension
Converts this DateTime to a LocalDate, ignoring the time and timezone. -
toLocalDateTime(
) → LocalDateTime -
Available on DateTime, provided by the DateTimes extension
Converts this DateTime to a LocalDateTime, ignoring the timezone. -
toLocalTime(
) → LocalTime -
Available on DateTime, provided by the DateTimes extension
Converts this DateTime to a LocalTime, ignoring the timezone. -
toOffsetTime(
) → OffsetTime -
Available on DateTime, provided by the DateTimes extension
Converts this DateTime to a OffsetTime, ignoring the timezone. -
toTimeString(
) → String -
Available on DateTime, provided by the DateTimes extension
Formats this DateTime's time as a ISO-8601 time, ignoring the date. -
toZonedDateTime(
) → ZonedDateTime -
Available on DateTime, provided by the DateTimes extension
Converts this DateTime to a ZonedDateTime. -
truncate(
{required TemporalUnit to}) → DateTime -
Available on DateTime, provided by the DateTimes extension
Returns a copy of this truncated to the TemporalUnit.
Operators
-
operator +(
Period period) → DateTime -
Available on DateTime, provided by the DateTimes extension
Returns a copy of this with theperiodadded. -
operator -(
Period period) → DateTime -
Available on DateTime, provided by the DateTimes extension
Returns a copy of this with theperiodsubtracted.