5
I am preparing a report based on the initial date (start_date) and final date (end_date).
My return from filter comes through the POST, if I use then print_r($_POST), I note that the date comes in the Brazilian standard, normal.
$start_date = ($filter['start_date']) ? date("Y-m-d", strtotime($filter['start_date'])) : null;
$end_date = ($filter['end_date']) ? date("Y-m-d", strtotime($filter['end_date'])) : null;
When using strtotime() to reverse the date, only the start_date works.
`start_date` : 2019-01-12
`end_date` : 1970-01-01
Result the print_r($_POST);
Array
(
[start_date] => 12/01/2019
[end_date] => 26/01/2019
)
Note: I noticed that if I type
13/01/2019, the return will be1970-01-01. So this happens because of the inversion, what would be the right way to do this?