You can format the time in several ways by manipulating this object Datetime. The documentation of this php method brings numerous ways to do it.
But as the question refers to the Brazilian format here goes:
$datetime2 = new DateTime('2011-01-01');
var_dump($datetime2->format('d/m/y'));
Exit: string(8) "01/01/11"
Another example:
$datetime1 = new DateTime('2011-01-02');
var_dump($datetime1->format('d*m*y'));
Exit: string(8) "02*01*11"
Make sure the time entered is in the pattern: ('ano-mes-dia')
. If no strange things will happen.
Now with the data in perfect order apply your methods:
$interval = $datetime1->diff($datetime2);
echo $interval->format('%R%a days');
Exit: 1
Nice. I didn’t know that! =)
– Andrei Coelho
Thank you very much!
– Mateus Gonçalves