Jump to content

Order by date ( display newest item )


scottrohe

Recommended Posts

Ok well I have everything right I just need to know WHICH date format I should use when entering the date into the db.
ex; I've tried:
[code=php:0]
<?php
      $date = date('dmy', strtotime($date));
?>
[/code]
so I get the result of '050806' but when I order that in a sql queue  'ORDER BY date DESC', and i test it by changing the date around on tables, it just doesn't work flawlessly. I was also wanting to add in like a timestamp so if 2 items are added at once, but one is added a second or two later, it's newer and therefore displays ahead of the one added 2 seconds before it.. what would my 'date' variable be? Thanks.
Link to comment
https://forums.phpfreaks.com/topic/16670-order-by-date-display-newest-item/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.