10 Replies Latest reply on Oct 2, 2013 4:49 PM by TheScarecrow

    Date array and Sorting

    TheScarecrow Level 1

      I have a date array that i created from a database.  I am trying to sort the dates into the correct order with the upcoming on top.... the best would be that after the date has passed it would go to the bottom of the list. Can anyone tell me if I am on the right path with what I have so far and give me any hints?  thanks (the second loop give me an error)

       

      <!--- Declare query array --->

      <cfset dateArray = arraynew(1)>

       

       

      <!--Poppulate Array row by row--->

      <cfloop query="CDE_Dates2">

                <cfset dateArray[currentRow][1] = event_date>

      </cfloop>

       

       

      <!--- Sort Array Dates --->

       

       

      <cfloop index="i" from="1" to="#arrayLen(dateArray)#">

                <cfset dateVar = DateFormat(dateArray[i],"YYYY/MM/DD")>

      </cfloop>