# difference method

Duration difference (DateTime other)

Returns a Duration with the difference between this and `other`.

    var berlinWallFell = new DateTime.utc(1989, DateTime.november, 9);
    var dDay = new DateTime.utc(1944, DateTime.june, 6);

    Duration difference = berlinWallFell.difference(dDay);
    assert(difference.inDays == 16592);

The difference is measured in seconds and fractions of seconds. The difference above counts the number of fractional seconds between midnight at the beginning of those dates. If the dates above had been in local time, not UTC, then the difference between two midnights may not be a multiple of 24 hours due to daylight saving differences.

For example, in Australia, similar code using local time instead of UTC:

    var berlinWallFell = new DateTime(1989, DateTime.november, 9);
    var dDay = new DateTime(1944, DateTime.june, 6);
    Duration difference = berlinWallFell.difference(dDay);
    assert(difference.inDays == 16592);

will fail because the difference is actually 16591 days and 23 hours, and Duration.inDays only returns the number of whole days.

## Implementation

    external Duration difference(DateTime other);