Returns a new DateTime instance with duration
subtracted from this
.
DateTime today = new DateTime.now();
DateTime sixtyDaysAgo = today.subtract(new Duration(days: 30));
Notice that duration being subtracted is actually 30 * 24 * 60 * 60 seconds
and if that crosses a daylight saving time change, the resulting DateTime
won't have the same time of day as today
, and may not actually hit the
calendar date 30 days earlier. Be careful when working with dates in local
time.
Source
external DateTime subtract(Duration duration);