Sort Order by Date

4 posts by 3 authors in: Forums > CMS Builder
Last Post: February 12, 2009   (RSS)

Re: [ThreeTree] Sort Order by Date

By Kenny - February 12, 2009

The easiest way is to create a date field and set your sorting to date DESC

Then on you page code you could put this

<?php echo date("F Y", strtotime($record['date'])) ?> Quick Tip

This would translate to Read January 2009 Quick Tip

Make Sense?


Kenny

Re: [sagentic] Sort Order by Date

Don't understand contents of date field so that sort will be by month within year. Is this an additional non printed field in the database? I am confused!

Re: [ThreeTree] Sort Order by Date

By Dave - February 12, 2009

Hi ThreeTree,

In order to sort by date you'll need to make sure you have a "date" type field (that shows pulldowns for month, year, etc) and then sort on that.

Is the field you're using now just a text field? If so, try adding a date field, setting the values for it, and sorting on that new field.

Hope that helps, let me know if you have any questions!
Dave Edis - Senior Developer
interactivetools.com