Jump to content

[SOLVED] date sorting issue


cheesycarrion

Recommended Posts

each time a row is updated, the date gets updated, and I want to sort each item by date with most recent at the top. the problem is that they're out of order with the month when there are months with one digit and months with two digits. the same also applies to the day and hour. I know how I would sort this in php, but if I just got all the data and sorted in in php, I wouldn't be able to use the sql limit. for this example, let's say there are 10 items per page.

 

 

here's what I have now:

 

page 1:

 

9/9/08 at 17:19

9/4/08 at 1:49

9/12/08 at 16:51

9/11/08 at 1:10

9/11/08 at 1:07

8/31/08 at 23:52

8/24/08 at 19:32

8/20/08 at 23:21

8/19/08 at 21:50

8/12/08 at 15:03

=======

page 2:

 

8/1/08 at 15:58

8/1/08 at 15:57

7/28/08 at 22:16

 

 

here's how I want it:

 

9/12/08 at 16:51

9/11/08 at 1:10

9/11/08 at 1:07

9/9/08 at 17:19

9/4/08 at 1:49

8/31/08 at 23:52

8/24/08 at 19:32

8/20/08 at 23:21

8/19/08 at 21:50

8/12/08 at 15:03

=======

page 2:

 

8/1/08 at 15:58

8/1/08 at 15:57

7/28/08 at 22:16

 

Is there something I can put in my query for this or should I just get all the items without a limit and sort in php?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.