Sort Order by Date
4 posts by 3 authors in: Forums > CMS Builder
Last Post: February 12, 2009 (RSS)
Am confused about setting up sort order for listings of items that will be identified by date. Will sort work on this format field? January 2006 Quick Tip, February 2006 Quick Tip ....January 2009 Quick Tip. If so can I specify descending order to have most recent first? Need to list Quick Tips by date and not sure how to accomplish this after reading online documentation.
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
This would translate to Read January 2009 Quick Tip
Make Sense?
Kenny
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!
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
interactivetools.com