2
Wore the strtotime()
to return to the previous month and always take the last day of the previous month, did so:
$data_teste = date('Y-m-t', strtotime('-1 month'));
And it was working so far (31-10-2018), instead of going back to 30-09-2018 it showed the day 31-10-2018, apparently the function goes back 30 days and not to "the previous month" as I thought it did. Does anyone know a way out of this situation?
When I used the first example you said above, it returned me to the last day of the last month of the last year that PHP can get back kkkk, I think it’s because of the PHP version that I’m required to use is 5.1.6 and he understood differently
– Geraldão de Rívia
There have been several changes between PHP 5.0.0 and 5.3.0. Some interpretations of the relative format have changed during this period.
– Gabriel Heming