Grabbing delimited dates from database and adding new ones to the list, then want to put all dates in correct order of the date.
<cfparam default="" name="newDates">
<cfloop index="tm" from="#form.arrive#" to="#form.depart#" step="#createTimespan(1,0,0,0)#">
<cfset newDates = newDates & '#dateFormat( tm, "mm/dd/yyyy" )#,'>
</cfloop>
<cfset penddate = '#pmonthlist#, #newDates#'>
How Can I take the results of this.
7/15/2012,7/16/2012,7/17/2012,7/18/2012,7/19/2012,7/20/2012,7/21/2012,9/21/2012,9/22/2012,9/28/2012,9/29/2012, 04/01/2012,04/02/2012,04/03/2012,04/04/2012,04/05/2012,04/06/2012,04/07/2012,
And make it into the correct date order like this. (this is the results I want)
04/01/2012,04/02/2012,04/03/2012,04/04/2012,04/05/2012,04/06/2012,04/07/2012,7/15/2012,7/16/2012,7/17/2012,7/18/2012,7/19/2012,7/20/2012,7/21/2012,9/21/2012,9/22/2012,9/28/2012,9/29/2012
UPDATE: Solution #0 – just sort them using
arraySort(dates, 'numeric')(doesn’t work in Railo), see: http://www.cfgears.com/index.cfm/2010/10/7/Using-an-array-to-sort-datesSolution #1 – sort an array of dates
datesinto an array usingListToArray()DateFormat()them asYYYYMMDDArraySort(dates, 'numeric')DateFormat()them back toM/D/YYYYArrayToList()Solution #2 – use Query of Queries
QueryAddRow()andQuerySetCell()SELECT MyDate FROM myQuery ORDER BY MyDateValueList(myQuery.myDate)Solution #3 – use Java
javacastto cast each date asjava.util.Datesort()injava.util.Collectionson the arraySolution #4 – use
DateCompare()DateCompare()to compare dates.Solution #5 – use DB temp table
ORDER BY