OffsetDateTime class Absolute times
A date and time at a fixed offset from UTC.
- Implemented types
- Annotations
-
- @immutable
Constructors
- OffsetDateTime.new(ZoneOffset offset, int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int nanosecond = 0])
-
Constructs an
OffsetDateTime
from an offset and the individual components of the date and time.factory - OffsetDateTime.fromDateTime(DateTime dateTime)
-
Constructs an
OffsetDateTime
from aDateTime
. - OffsetDateTime.fromInstant(HasInstant hasInstant, [ZoneOffset? offset])
-
Constructs an
OffsetDateTime
from anInstant
and a fixed offset from UTC. - OffsetDateTime.fromLocalDateTime(LocalDateTime dt, ZoneOffset offset)
-
Constructs an
OffsetDateTime
from aLocalDateTime
at a fixed offset from UTC.factory - OffsetDateTime.now()
-
Constructs an
OffsetDateTime
with the current date and time in the local time zone. - OffsetDateTime.parse(String isoString)
-
Parses an
OffsetDateTime
from an ISO-8601 formatted string.factory
Properties
- asInstant → Instant
-
Converts this to an Instant.
no setteroverride
- day → int
-
The day starting at 1.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setteroverride
- hour → int
-
The hour from 0 to 23.
no setteroverride
- minute → int
-
The minute from 0 to 59.
no setteroverride
- month → int
-
The month from 1 to 12.
no setteroverride
- nanosecond → int
-
The nanoseconds from 0 to 999,999,999.
no setteroverride
- offset → ZoneOffset
-
The amount the time zone is offset from UTC.
final
- ordinalDay → int
-
The number of days since the beginning of the year.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- second → int
-
The second from 0 to 59.
no setteroverride
- unixTimestamp → Timespan
-
The amount of time since midnight, January 1, 1970 UTC.
no setteroverride
- weekday → Weekday
-
The day of the week.
no setteroverride
- year → int
-
The year.
no setteroverride
Methods
-
atOffset(
ZoneOffset offset) → OffsetDateTime -
Converts this to an OffsetDateTime with the given
offset
.override -
compareTo(
HasInstant other) → int -
Compares this to another
HasInstant
.override -
inTimezone(
[String? zoneId]) → ZonedDateTime -
Converts this to a ZonedDateTime in the time zone given by
zoneId
.override -
minusPeriod(
Period period) → OffsetDateTime -
Subtracts a
Period
of time. -
minusTimespan(
Timespan timespan) → OffsetDateTime -
Subtracts a
Timespan
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
plusPeriod(
Period period) → OffsetDateTime -
Adds a
Period
of time. -
plusTimespan(
Timespan timespan) → OffsetDateTime -
Adds a
Timespan
. -
timespanUntil(
HasInstant other) → Timespan -
Finds the amount of time between this and another instant in time.
override
-
toDateTime(
) → DateTime -
Converts this to a DateTime in the local time zone.
override
-
toLocal(
) → LocalDateTime -
Converts this to a
LocalDateTime
. -
toString(
) → String -
Formats this as an ISO 8601 date time with offset.
override
Operators
-
operator <(
HasInstant other) → bool -
Less than operator.
override
-
operator <=(
HasInstant other) → bool -
Less than or equals operator.
override
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator >(
HasInstant other) → bool -
Greater than operator.
override
-
operator >=(
HasInstant other) → bool -
Greater than or equals operator.
override
Static Properties
- maximum → OffsetDateTime
-
The latest possible datetime.
final
- minimum → OffsetDateTime
-
The earliest possible datetime.
final