0
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 an Sql in date format(%dd/%mm) ie 00/00
The date is just that? I’ll wait until you ask the question correctly. The previous one you asked me raised doubts in the answer. This is not a valid date, it’s a string
– user60252
The variable receives a date, I would just like to order increasingly
– Aprendizzz
yy is year is right?
– user60252
date is something like this
2018-08-12
– user60252
Forgiveness is day and month
– Aprendizzz
It is already in the correct format example 30/05 with the "/" tbm
– Aprendizzz
Right, obgd for the attention
– Aprendizzz
I used the usort function in php, it ordered but a date 00/00 was in front of the other kk
– Aprendizzz
and where this date 00/00 ?
– user60252
It must be some data that is without date, I have to check further sinking. There was a coincidence of the search that I made come with the dates in sequence
– Aprendizzz