Bubblesorting Dates

Results 1 to 2 of 2

Thread: Bubblesorting Dates

  1. #1
    Join Date
    Dec 1969

    Default Bubblesorting Dates

    Hi,<BR>I&#039;m using a standard bubblesort routine that I got off 4guys to sort a bunch of files into date order. The problem is that it seems to be sorting things based on the &#060;i&#062;day&#060;/i&#062; rather than the date. On other words, it puts (UK Notation DD/MM/YY) 16/01/02 higher than 07/02/02. What can I do so it sorts by the whole date? BTW, the data submitted to the function has been passed through a DateValue() function so it should be recognised as date format.<BR><BR>Sub SingleSorter( byRef arrArray )<BR> Dim row, j<BR> Dim StartingKeyValue, NewKeyValue, swap_pos<BR><BR> For row = 0 To UBound( arrArray ) - 1<BR> StartingKeyValue = arrArray ( row )<BR> NewKeyValue = arrArray ( row )<BR> swap_pos = row<BR> <BR> For j = row + 1 to UBound( arrArray ).<BR> If arrArray ( j ) &#060; NewKeyValue Then<BR> swap_pos = j<BR> NewKeyValue = arrArray ( j )<BR> End If<BR> Next<BR> <BR> If swap_pos &#060;&#062; row Then <BR> arrArray ( swap_pos ) = StartingKeyValue<BR> arrArray ( row ) = NewKeyValue<BR> End If <BR> Next<BR>End Sub

  2. #2
    Join Date
    Dec 1969

    Default How about...

    ...turning them into ANSII-standard?<BR><BR>i.e. yyyymmdd<BR><BR>That way, whether it uses them as strings or dates, they&#039;ll be done properly.<BR><BR>Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts