ZonedDateTime class
A date-time with a time-zone, such as July 20, 1969, 8:18pm GMT.
- Inheritance
- Implemented types
- Available extensions
Constructors
- ZonedDateTime(LocalDateTime dateTime, ZoneId zone)
-
Constructs a new LocalDateTime by combining a
dateTime
with azone
.factory - ZonedDateTime.from(Temporal temporal)
-
Constructs a new ZonedDateTime instance
from the given temporal.
factory
- ZonedDateTime.fromMicrosecondsSinceEpoch(int microsecondsSinceEpoch, ZoneId zone)
-
Constructs a new ZonedDateTime instance
with the given
microsecondsSinceEpoch
. - ZonedDateTime.now(ZoneId zone)
-
Constructs a new ZonedDateTime instance with current date and time
in the given
zone
.factory - ZonedDateTime.of(DateTime dateTime)
-
Constructs a new ZonedDateTime instance from the given
dateTime
.factory - ZonedDateTime.parse(String formattedString)
-
Constructs a new ZonedDateTime instance based on
formattedString
.factory
Properties
- day → int
-
The day of the month
[1..31]
.no setterinherited - dayOfWeek → DayOfWeek
-
The day of the week
[monday..sunday]
.no setter - dayOfWeek → DayOfWeek
-
Available on DateTime, provided by the DateTimeExtensions extension
The day of the week[monday..sunday]
.no setter - epochDay → int
-
The epoch-day. Count of days since epoch (1970-01-01).
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hour → int
-
The hour of the day, expressed as in a 24-hour clock
[0..23]
.no setterinherited - isLeapYear → bool
-
Whether the year is a leap year.
no setter
- isUtc → bool
-
True if this DateTime is set to UTC time.
finalinherited
- localDate → LocalDate
-
Returns a new LocalDate instance from this ZonedDateTime.
no setter
- localDateTime → LocalDateTime
-
Returns a new LocalDateTime instance from this ZonedDateTime.
no setter
- localTime → LocalTime
-
Returns a new LocalDateTime instance from this ZonedDateTime.
no setter
- microsecond → int
-
The microsecond
[0...999]
.no setterinherited - microsecondOfDay → int
-
The microsecond of day.
no setter
- microsecondsSinceEpoch → int
-
The number of microseconds since
the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setterinherited
- millisecond → int
-
The millisecond
[0...999]
.no setterinherited - millisecondsSinceEpoch → int
-
The number of milliseconds since
the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setterinherited
- minute → int
-
The minute
[0...59]
.no setterinherited - month → int
-
The month
[1..12]
.no setterinherited - offsetSeconds → int
-
The offset in seconds from UTC.
no setter
- prolepticMonth → int
-
The proleptic month. Count of months since year 0.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- second → int
-
The second
[0...59]
.no setterinherited - timeZoneName → String
-
The time zone name.
no setterinherited
- timeZoneOffset → Duration
-
The time zone offset, which
is the difference between local time and UTC.
no setterinherited
- weekday → int
-
The day of the week monday..sunday.
no setterinherited
- year → int
-
The year.
no setterinherited
- zone → ZoneId
-
The zone that this ZonedDateTime is in
[utc|system]
.no setter
Methods
-
add(
Duration duration) → DateTime -
Returns a new DateTime instance with
duration
added to this DateTime.inherited -
adjust(
ChronoField field, int newValue) → ZonedDateTime -
Returns a new instance of this Temporal
with the given
field
adjusted tonewValue
.override -
atEndOfMonth(
) → T -
Available on T, provided by the TemporalAdjusters extension
Returns a new instance of this Temporal at the end of the month. -
atStartOfMonth(
) → T -
Available on T, provided by the TemporalAdjusters extension
Returns a new instance of this Temporal at the start of the month. -
atStartOfWeek(
[String? locale]) → T -
Available on T, provided by the TemporalWeekFields extension
Returns a new instance of this Temporal at the start of the week. -
compareTo(
DateTime other) → int -
Compares this DateTime object to
other
, returning zero if the values are equal.inherited -
copyWith(
{int? year, int? month, int? dayOfMonth, int? hour, int? minute, int? second, int? millisecond, int? microsecond, ZoneId? zone}) → ZonedDateTime - Returns a new instance of this ZonedDateTime with the given individual properties adjusted.
-
copyWith(
{int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond, bool? isUtc}) → DateTime -
Available on DateTime, provided by the DateTimeCopyWith extension
Creates a new DateTime from this one by updating individual properties. -
difference(
DateTime other) → Duration -
Returns a Duration with the difference when subtracting
other
from this DateTime.inherited -
get(
ChronoField field) → int -
Returns the value for the given
field
of this Temporal.override -
isAfter(
DateTime other) → bool -
Whether this DateTime occurs after
other
.inherited -
isAtSameMomentAs(
DateTime other) → bool -
Whether this DateTime occurs at the same moment as
other
.inherited -
isBefore(
DateTime other) → bool -
Whether this DateTime occurs before
other
.inherited -
minus(
int amountToSubtract, ChronoUnit unit) → ZonedDateTime -
Returns a new instance of this Temporal
with the given
amount
subtracted.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
plus(
int amountToAdd, ChronoUnit unit) → ZonedDateTime -
Returns a new instance of this Temporal
with the given
amount
added.override -
subtract(
Duration duration) → DateTime -
Returns a new DateTime instance with
duration
subtracted from this DateTime.inherited -
toIso8601String(
) → String -
Returns an ISO-8601 full-precision extended format representation.
inherited
-
toLocal(
) → ZonedDateTime -
Returns this DateTime value in the local time zone.
override
-
toLocalDate(
) → LocalDate -
Available on DateTime, provided by the DateTimeExtensions extension
Returns a new LocalDate instance from this DateTime. -
toLocalDateTime(
) → LocalDateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Returns a new LocalDateTime instance from this DateTime. -
toLocalTime(
) → LocalTime -
Available on DateTime, provided by the DateTimeExtensions extension
Returns a new LocalTime instance from this DateTime. -
toString(
) → String -
Returns a human-readable string for this instance.
override
-
toUtc(
) → ZonedDateTime -
Returns this DateTime value in the UTC time zone.
override
-
toZonedDateTime(
) → ZonedDateTime -
Available on DateTime, provided by the DateTimeExtensions extension
Returns a new ZonedDateTime instance from this DateTime. -
until(
Temporal endExclusive, ChronoUnit unit) → int -
Returns the difference in the given
unit
between this Temporal andendExclusive
.override -
withZoneSameInstant(
ZoneId zone) → ZonedDateTime -
Returns a new instance of this ZonedDateTime with a different
zone
at the instant.
Operators
-
operator +(
TemporalAmount amount) → ZonedDateTime -
Returns a new instance of this Temporal
with the given
amount
added.override -
operator -(
TemporalAmount amount) → ZonedDateTime -
Returns a new instance of this Temporal
with the given
amount
subtracted.override -
operator <(
ZonedDateTime other) → bool -
Whether this ZonedDateTime occurs before
other
. -
operator <=(
ZonedDateTime other) → bool -
Whether this ZonedDateTime occurs before or at the same moment as
other
. -
operator ==(
Object other) → bool -
Whether
other
is a DateTime at the same moment and in the same time zone (UTC or local).inherited -
operator >(
ZonedDateTime other) → bool -
Whether this ZonedDateTime occurs after
other
. -
operator >=(
ZonedDateTime other) → bool -
Whether this ZonedDateTime occurs after or at the same moment as
other
.