Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8126851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:18:23+00:00 2026-06-06T07:18:23+00:00

I am trying to sort a two-dimensional array by a timestamp column Descending. This

  • 0

I am trying to sort a two-dimensional array by a timestamp column Descending. This collumn (index 11) is in the format: ‘yyyy-MM-dd HH:mm:ss’. I have tried multiple things. According to the topics I’ve read, this code should work:

 List.sort(function(x, y){
     return Date.parse(y[11]) - Date.parse(x[11]);
});

Thank you in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:18:25+00:00Added an answer on June 6, 2026 at 7:18 am

    That will work on up-to-date browsers that support the only-recently-defined input format for Date.parse (prior to ES5, it was just “parse whatever Date#toString spits out”).

    Although never spec’d, older browsers will support it with / rather than - in the date, so:

    List.sort(function(x, y){
         return Date.parse(y[11].replace(/-/g, '/')) - Date.parse(x[11].replace(/-/g, '/'));
    });
    

    Always test on your target browsers, of course, because again this was never specified.

    For example, on IE8 and earlier:

    display(Date.parse("2012-06-01 14:22:17"));
    

    …is NaN, but:

    display(Date.parse("2012/06/01 14:22:17"));
    

    …is 1338556937000.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

iam trying to sort this array by array[key]['premium']['Monthly'] and if there are two Monthly
Trying to sort this array of objects according to (1) depth and (2) weight,
This post is a two-parter. I'm trying to sort a set of ip statements
I have two large vectors, I am trying to do some sort of element
I'm trying to sort everything out using array & loops lets say this is
I was trying to implement a sort of shared cache between two or more
Been trying to sort this one out for a while. I'd really appreciate any
I am trying to sort an array in PHP by date and time which
I'm trying to sort by the state of an Organization's main address. I have
I'm trying to sort the employees object array by age and i'm getting the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.