PHP:
array_push($var, $linha['data']);
array_push($var, $linha['data_t']);
array_push($var, $linha['data_f']);
usort($var);// Adicionei essa linha para tentar formatar as datas da menor pra maior mas retornou o erro
Warning: usort () expects exactly 2 parameters, 1 given
$var = array_unique($var);
foreach ($var as $v) {
echo "<td><div class='data'>" . $v . "</div></td>";
}
JS:
var data = [];
for(var i = 0; i < $(".data").length ; i++)
{
data[i] = $(".data").eq(i).text();
}
I have this loop that takes the php date.
The problem is that at the time of printing it prints for example: 02 / 05,05 / 05,01 / 05.
I would like to sort the variable data[]
in ascending order of date.
I get the date in a Sql in date format (% dd /% mm) ie 00/00