You are here: Re: How to sort date based on Today « PHP SQL « IT news, forums, messages
Re: How to sort date based on Today

Posted by Rich on 10/14/53 11:45

On Thu, 13 Apr 2006 02:23:24 GMT, Don Hobson wrote...
>
>I need to sort my job postings from today to the past, but my date sort
>basically sorts dates from January to December. How do I get the sort to
>start from the today's date back
>
>SELECT jobs.id, jobs.jobtitle, jobs.companyname, jobs.zipcodeId,
>jobs.neighborhoodId, neighborhood.name, jobs.created FROM jobs, neighborhood
>WHERE jobs.neighborhoodId = neighborhood.id ORDER BY created DESC
>
>Lets say today is April 12th.
>
>I store the dates in mysql as epoch dates (1165963600)
>My sort incorrectly shows like this descending
>
>Dec 12 - 1165963600
>Aug 19
>Aug 19
>Jul 08
>Jul 08
>Jun 05
>Apr 12
>Apr 12
>Apr 12
>
>
>I want it to show like this for
>
>Apr 12
>Apr 12
>Apr 12
>
>Dec 12
>Aug 19
>Aug 19
>Jul 08
>Jul 08
>Jun 05
>
>

I wasn't sure what your other epoch dates looked like but one for "1165963600"
was for a date in the future (think it's "Dec 12 2006"). Depending on the type
of column (integer, date, text, etc.) that might mix things up on a sort since
one method may be numeric and another may be an alpha sort.

Rich


--
Carry Forward Bandwidth! Included In All NewsGuy Accounts!
Don't lose what you don't use! - http://newsguy.com/overview.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация