Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sort file as Month name in ColdFusion

I have a directory, it contains files like:

january2009.xml, february2009.xml, march2009.xml,april2009.xml,january2010.xml, february2010.xml, march2010.xml,april2010.xml ...

I use the cfdirectory to get the file by year. Right now, I want to display it as sorted order in month. Say If I only want year 2009 data. I want it sorted as

january2009.xml, february2009.xml, march2009.xml,april2009.xml

but not

april2009.xml, february2009.xml, january2009.xml, march2009.xml

Anyone has easy way to do it in ColdFusion?

like image 667
Simon Guo Avatar asked Jan 22 '23 01:01

Simon Guo


1 Answers

I won't provide a solution to your problem, but rather make a suggestion. If it's very important to have these sorted by date, you would be better off using ISO 8601 format in your file naming convention (e.g. 2009-02.xml instead of february2009.xml). Sorting would become very easy.

like image 99
Gert Grenander Avatar answered Jan 28 '23 22:01

Gert Grenander