There are dates in the first column of the table:

<table> <tr> <td>01.12.2013 21:08:52</td> <td>...</td> </tr> <tr> <td>19.10.2014 1:13:12</td> <td>...</td> </tr> <tr> <td>19.10.2014 1:53:12</td> <td>...</td> </tr> </table> 

It is necessary to show only the last by date (dmg, without comparing time) lines.

Update

I am not a student and the task is not educational, everything is for understanding and comes down to the practice of working with parsing and date on JS.

 $('table > tbody > tr > td:nth-child(1)').each(function() { if($(this).text() != last){ $(this).closest("tr").hide(); } }); 

How to parse dates optimally and compare?

  • one
    @aliokero, According to the rules of the forum, questions should not be limited to solving or completing student assignments. Please clarify what you have done yourself and what did not work out. - Sergiks
  • Updated the question - aliokero

1 answer 1

It is necessary to break the date into components, and collect the Date object.

 19.10.2014 1:53:12 

First, the space can be divided into an array of two elements: the date and time. Time is ignored, and the components of the date are already broken by points:

 .split(" ")[0].split(".") 

This will give an array of three elements: day, month, year. They can be fed into the constructor of the Date object :

 new Date( parts[2], parts[1], parts[0]) 

From it, you can take the number of microseconds since the beginning of the unix era (integer) using the getTime() method.

It is necessary to run through all the <tr> rows of the table once, take the first <td> in them and pull that timestamp out of it, collecting unique values ​​in the array. Then sort it and pick up the highest value - the freshest day.

Now this timestamp must be converted to a date string in your format, adding "0" before single-digit dates and months, and get a sample string like "10/19/2014".

Having run through all the lines again, hide those in which the date (after splitting again by the space) is not equal to the sample.

Working example

  • Thank you very much, from the heart! - aliokero