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

  • SEARCH
  • Home
  • 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 7499459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:49:58+00:00 2026-05-29T19:49:58+00:00

I am trying to sort a list of records that have been created using

  • 0

I am trying to sort a list of records that have been created using a screen scraping script. The script adds the following style of date and time (timestamp) to each record:

13 Jan 14:49

The script runs every 15 minutes, but if I set the sort order to ‘time DESC’ it doesn’t really make sense because it lists the records as follows:

13 Jan 14:49
13 Jan 12:32
13 Jan 09:45
08 Feb 01:10
07 Feb 23:31
07 Feb 06:53
06 Feb 23:15

As you can see, it’s listing the first figure correctly (the day of the month in number form) but it’s putting February after January. To add to the confusion it’s putting the latest date in February at the top of the February section.

Is there a better way of sorting these so they are in a more understandable order?

  • 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-05-29T19:50:00+00:00Added an answer on May 29, 2026 at 7:50 pm

    If you are storing the values in a database, simply use the column type datetime when creating the field. The database will treat the field as time and will sort the values chronologically.

    Otherwise, if you are storing the values elsewhere, for example in a flat file, convert the formatted time to unix time. Unix time is an integer, thus you can sort it easier.

    Time.parse("13 Jan 09:45").to_i
    # => 1326444300
    Time.parse("08 Feb 01:10").to_i
    # => 1328659800 
    

    You can always convert a unix time to a Time instance.

    Time.at(1328659800).to_s
    # => "2012-02-08 01:10:00 +0100" 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to sort a singly linked list which has been created and
I am trying to sort a Vector list using the Java Collections frameworks. This
I am trying to sort data which is from Generic List object. By using
I'm trying to implement a custom sort field for a list of records. When
I am trying to sort records (structs) by their names. And I'm using strcmp
I'm trying to sort a list of tweets (class: SimpleTweet), which each have ID
I am trying to sort a list using delegates but I am getting a
I'm trying to sort a list of posts where votes have priority over the
I am trying to sort a list of names followed by another string such
I'm trying to sort a list of CLLocationDistance values by closest distance (ascending order).

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.