operator == method

bool operator ==(other)

Returns true if other is a DateTime at the same moment and in the same time zone (UTC or local).

DateTime dDayUtc   = new DateTime.utc(1944, DateTime.JUNE, 6);
DateTime dDayLocal = new DateTime(1944, DateTime.JUNE, 6);

assert(dDayUtc.isAtSameMomentAs(dDayLocal) == false);

See isAtSameMomentAs for a comparison that adjusts for time zone.

Source

bool operator ==(other) {
  if (!(other is DateTime)) return false;
  return (_value == other._value && isUtc == other.isUtc);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-core/DateTime/operator_equals.html