DateTime.addDays vs plusDays


#1

The difference is that “add” will change the original object while “plus” will create a new instance without mutating the old one.
Example:
By using var dt = DateTime.now(); dt.addDays(1) you can change the original instance by adding one day. By using dt.plusDays(1) you will get a new instance of DateTime by adding one day to the original instance. The same applies to hours, months and etc.


#2

Also addDays (along with addHours, addMinutes, etc) is deprecated and should not be used.