UtcDateTime class

An immutable date-time in the UTC±00:00 timezone.

Inheritance
Mixed-in types
Available extensions

Constructors

UtcDateTime(int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0])
Creates a UtcDateTime with the given parameters.
UtcDateTime.fromMicroseconds(int microseconds)
Creates a UtcDateTime from the given microseconds since epoch.
UtcDateTime.fromMilliseconds(int milliseconds)
Creates a UtcDateTime from the given milliseconds since epoch.
UtcDateTime.now()
Creates a UtcDateTime that represents the current date and time.
factory

Properties

date Date
The date of this DateTime.
no setterinherited
datePart Date?
The date part of this DateTime.
getter/setter pairinherited
day int
The day of the month [1..31].
no setterinherited
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
isUtc bool
True if this DateTime is set to UTC time.
finalinherited
microsecond int
The microsecond [0...999].
no setterinherited
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
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second int
The second [0...59].
no setterinherited
time Time
The time of this DateTime.
no setterinherited
timePart Time?
The time part of this DateTime.
getter/setter pairinherited
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
tomorrow UtcDateTime
Returns a DateTime that represents the day after this DateTime.
no setterinherited
weekday int
The day of the week monday..sunday.
no setterinherited
year int
The year.
no setterinherited
yesterday UtcDateTime
Returns a DateTime that represents the day before this DateTime.
no setterinherited

Methods

add(Duration duration) DateTime
Returns a new DateTime instance with duration added to this DateTime.
inherited
ceil(int value, TimeUnit unit) UtcDateTime
Ceils this DateTime to the nearest value.
inherited
compareTo(DateTime other) int
Compares this DateTime object to other, returning zero if the values are equal.
inherited
difference(DateTime other) Duration
Returns a Duration with the difference when subtracting other from this DateTime.
inherited
floor(int value, TimeUnit unit) UtcDateTime
Floors this DateTime to the nearest value.
inherited
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
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
of(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond) UtcDateTime
Creates a RoundableDateTime using the given parameters.
override
round(int value, TimeUnit unit) UtcDateTime
Rounds this DateTime to the nearest value.
inherited
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() DateTime
Returns this DateTime value in the local time zone.
inherited
toString() String
Returns a human-readable string for this instance.
inherited
toUtc() DateTime
Returns this DateTime value in the UTC time zone.
inherited

Operators

operator +(Duration duration) UtcDateTime
Returns a DateTime that represents this DateTime with the given duration added.
override
operator -(Duration duration) UtcDateTime
Returns a DateTime that represents this DateTime with the given duration subtracted.
inherited
operator ==(Object other) bool
Whether other is a DateTime at the same moment and in the same time zone (UTC or local).
inherited