Jump to content

sorting table Date


Best-Killer

Recommended Posts

1 hour ago, iPrestege said:

table.sort ( table, function ( a,b )  return a.value < b.value end ); 

-- or

table.sort ( table, function ( a,b )  return a.value > b.value end ); 

You can do it like this.

@Best-Killer

< > Control them from the bigger to the smallest one.

Thx Work For me ^^ 

1 hour ago, pa3ck said:

local dates = {
 
    "2017-01-09",
    "2017-01-06",
    "2017-01-08",
    "2017-01-01"
    
}
table.sort ( dates, function ( a,b )  return a < b end ); 

for k, v in ipairs(dates) do
    print(v)
end

--Returns

--2017-01-01
--2017-01-06
--2017-01-08
--2017-01-09

 

Thanx too bro 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...