They both implement the DateTimeInterface interface, which specifies the non-modifying methods of DateTime/DateTimeImmutable.