0
Hello, I am searching from the bank a data information in a grid with various information, I am doing so:
$data = $tbdeliberacoes->getData();
date("d/m/Y", strtotime($data));
and this is my return on screen:
31/12/1969
for all fields it shows that date. But dates saved in the database are normal.
The field I want to search is of the type Date.
When you print it
$data
it comes in what format?– rray
the variable $data is printed d/m/Y
– Estácio Di Fabio
If
$data = $tbdeliberacoes->getData();
already returns ind/m/Y
does not need date or strtotime.– rray
I don’t quite understand the question. Are you returning all the correct data, only the dates appear repeated? If yes, it is not lacking to increase the iteration with the results, as for example with the use of foreach ?
– DIANGELISJ
Yes, the field in the database is of type DATE, I search the date in a symfony "json" file. In this I put date(’d/m/Y', strtotime($tbdeliberacoes->getData()), in the action I put: list($dia, $mes, $ano) = explode("/", $request->getParameter($field)); $data = date("Y-m-d", strtotime($year."-".$mes."-".$day)); $arrQuery[] = 'upper(date) LIKE '%'. strtoupper($data) . '%'; If I enable debug mode I get this error: Warning: strtotime() expects Parameter 1 to be string If I disable debug mode all dates appear as: 31/12/1969
– Estácio Di Fabio