use DateTime object instead of strtotime function
standardize code