Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sort an array with dates

Status
Not open for further replies.

Albano

Instructor
Dec 11, 2000
221
PT
Hi,

Someane have a code to sort an array fill with dates in the fromat dd/mm/yy.

Thanks,

Albano de Sá
 
This thread should get you started. It is discussing alpabetic sorting, but the priciples are the same for dates. Post back with your code or any problems.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Brute force method (bubble sort):
Say the array of dates is a()
[tt]
For i=0 To UBound(a)
For j=i+1 To UBound(a)
If CDate(a(i))>CDate(a(j)) Then
tmp=a(i)
a(i)=a(j)
a(j)=tmp
End If
Next
Next[/tt]

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi,

What thread TomThumbKP, I think you forget the link.

PHV the sort code only sort dates by day, do you have someting that sort by day asn month.

Thanks,

Albano
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top