isBefore method

bool isBefore(DateTime other)

Returns true if this occurs before other.

The comparison is independent of whether the time is in UTC or in the local time zone.

DateTime berlinWallFell = new DateTime(1989, 11, 9);
DateTime moonLanding    = DateTime.parse("1969-07-20 20:18:00");

assert(berlinWallFell.isBefore(moonLanding) == false);

Source

bool isBefore(DateTime other) {
  return _value < other._value;
}

© 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/isBefore.html