-
September 20th, 2004, 11:31 PM
#1
sorting a date field in the list?
I have a list, that displays there columns,one of them is a date field and when I go into properties I can assign sorting properties for each of those column,so that is what I have done.
But the product of the date field sort is that the field is sorted like (1 apr 1999, 1 apr 2000) so it really sorts by the first digit, insted of looking at the date as a whole.
i am not aware if we can do anything to get this to sort the way I need it, and if not how would you do it and can it be done, I am sure it can.
Thanks
-
September 20th, 2004, 11:43 PM
#2
Re: sorting a date field in the list?
i haven't done this in VB, but to get around it in another language (Jade) I create an invisible column that stores the date in a format that can be sorted on. then when someone clicks the column to sort on the displayed field, you redirect the sort and tell it to use the hidden field instead.
Hope that helps - like I say, I've never done it in VB
-
September 21st, 2004, 06:00 AM
#3
Re: sorting a date field in the list?
That is indeed the way to do that in VB.
In order to be able to sort on a date correctly, you will need to store it in the form YYYYMMDD.
-
September 21st, 2004, 06:14 AM
#4
Re: sorting a date field in the list?
As stated by Cakkie, the best way is to have the dates reformatted first into a specific string format YYYYMMDD. But it will depend also on how you sort the field, if you want to use the ADO recordset object you can store the date directly into a DATE field, and from there sort the records by setting the Sort property with the field name, and finally retrieve the sorted records by looping the recordset into your list.
Busy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|