Sort File Lists By Date?

Permalink 1 user found helpful
How can I sort file lists by date? There's a method for filtering by date, but I would prefer to be able to simply sort the list based on the date the file was uploaded, either ascending or descending. Is there any way to do this other than loading each file object and doing it myself?

Thanks!

elyon
 
Tony replied on at Permalink Reply
Tony
check out the FileList class. & there should be a method there specifically for sorting by date.
elyon replied on at Permalink Reply
elyon
I see ... it was hidden in there. What I needed was "sortBy," which was defined in a parent class, as well as the tag for date, which took some hunting to find.

Thanks Tony
bdykstra replied on at Permalink Reply
Any chance you have some sample code? I need to do this as well (sort a filelist, which I'm pulling from a file set, by date added).

Thanks!

Bill
mkly replied on at Permalink Reply
mkly
Loader::model('file_list');
$fl = new FileList();
$fl->sortBy('fDateAdded', 'asc');
$files = $fl->get();

How about that?
bdykstra replied on at Permalink Reply
Very nice!
Thanks much! (quick reply too!)

Bill