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 3961918
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:02:01+00:00 2026-05-20T03:02:01+00:00

I am capturing dates in the following format: Mon, February 14, 2011, 08:22:34 AM

  • 0

I am capturing dates in the following format:

Mon, February 14, 2011, 08:22:34 AM

When I sort posts by the most recent date/time by using ORDER BY date_time DESC, sometimes it sorts it correctly and sometimes it doesn’t. So is there a better way to capture data so that the sorting will be done correctly?

For instance, work ten entries in a row it might sort properly, that is it will show the most recent posts first. Then after that it might put the most recent one at the very bottom

  • 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-20T03:02:02+00:00Added an answer on May 20, 2026 at 3:02 am

    Per discussion on OP, you are storing the date as a string. MySQL has many date sorting functions that can sort accurately, but the must be used in conjunction with a DATE type field. You should either convert the field type to date/datetime, or perform a cast function to turn them into date types for the purpose of sorting. Like this:

    SELECT CAST(datefield as date) AS date_format ORDER BY date_format DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble capturing the digits in a string of this format (t|b|bug_|task_|)1234 using
I am using below code to get the current time in specific format and
I am capturing an image using the following code public class PictureDemo extends Activity
We are capturing a visible tab in a Chrome browser (by using the extensions
I am using a capturing software, Abbyy FlexiCapture, after user done the verification (some
We are capturing packets to a file using tcpdump() . I need to write
How to display a time and date like below image. I have a code
I am doing video capturing through webcam using jmf. i am very new to
Currently i m capturing the screen using the glreadpixels(). the image captured is generally
Using regex, I want to match the following strings: January 25 Jan 25 I'm

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.