removed unnecessary test
Removed unnecessary elseif and modified copying DateTime object to support PHP 5.2