TZDateTime class

TimeZone aware DateTime

Implemented types
Available Extensions

Constructors

TZDateTime(Location location, int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0])
Constructs a TZDateTime instance specified at location time zone.
TZDateTime.from(DateTime other, Location location)
Constructs a new TZDateTime instance from the given DateTime in the specified location.
TZDateTime.fromMicrosecondsSinceEpoch(Location location, int microsecondsSinceEpoch)
TZDateTime.fromMillisecondsSinceEpoch(Location location, int millisecondsSinceEpoch)
Constructs a new TZDateTime instance with the given millisecondsSinceEpoch.
TZDateTime.local(int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0])
Constructs a TZDateTime instance specified in the local time zone.
TZDateTime.now(Location location)
Constructs a TZDateTime instance with current date and time in the location time zone.
TZDateTime.utc(int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0])
Constructs a TZDateTime instance specified in the UTC time zone.

Properties

day int
The day of the month 1..31.
no setteroverride
hashCode int
The hash code for this object.
no setteroverride
hour int
The hour of the day, expressed as in a 24-hour clock 0..23.
no setteroverride
isLocal bool
True if this TZDateTime is set to Local time.
no setter
isUtc bool
True if this TZDateTime is set to UTC time.
no setteroverride
location Location
Location
final
microsecond int
The microsecond 0...999.
no setteroverride
microsecondsSinceEpoch int
The number of microseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setteroverride
millisecond int
The millisecond 0...999.
no setteroverride
millisecondsSinceEpoch int
The number of milliseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setteroverride
minute int
The minute 0...59.
no setteroverride
month int
The month 1..12.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second int
The second 0...59.
no setteroverride
timeZone TimeZone
TimeZone
final
timeZoneName String
The abbreviated time zone name—for example, "CET" or "CEST".
no setteroverride
timeZoneOffset Duration
The time zone offset, which is the difference between time at location and UTC.
no setteroverride
weekday int
The day of the week.
no setteroverride
year int
The year.
no setteroverride

Methods

add(Duration duration) TZDateTime
Returns a new TZDateTime instance with duration added to this.
override
compareTo(DateTime other) int
Compares this TZDateTime object to other, returning zero if the values occur at the same moment.
override
difference(DateTime other) Duration
Returns a Duration with the difference between this and other.
override
isAfter(DateTime other) bool
Returns true if this occurs after other.
override
isAtSameMomentAs(DateTime other) bool
Returns true if this occurs at the same moment as other.
override
isBefore(DateTime other) bool
Returns true if this occurs before other.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
subtract(Duration duration) TZDateTime
Returns a new TZDateTime instance with duration subtracted from this.
override
toIso8601String() String
Returns an ISO-8601 full-precision extended format representation.
override
toLocal() TZDateTime
Returns this DateTime value in the local time zone.
override
toString() String
Returns a human-readable string for this instance.
override
toUtc() TZDateTime
Returns this DateTime value in the UTC time zone.
override

Operators

operator ==(Object other) bool
Returns true if other is a TZDateTime at the same moment and in the same Location.
override

Static Methods

parse(Location location, String formattedString) TZDateTime
Constructs a new TZDateTime instance based on formattedString.
override

Constants

maxMillisecondsSinceEpoch → const int
Maximum value for time instants.
minMillisecondsSinceEpoch → const int
Minimum value for time instants.