Change ShortDate to SQLDate

Hi. In a previous version of one of my apps, I had the date saving as ShortDate. This date is present in a listbox with other items. Ideally, I wanted this listbox to sort by date in decending order, but it does not with ShortDate and does with SQLDate. Is there a quick way to automatically change each of the dates to SQLDate in the listbox without having to manually change each? I’m racking my brain trying to figure this out

Store the sqldate time in the cell tag then sort those instead.

Thanks Russ. I’ve never worked with Celltag before. Wouldn’t there still need to be a conversion of the date for the pre-existing dates in the box? That’s what I am trying to do

To convert the dates, use ParseDate or write your own parser to a Date object, then pull the SQLDate out of that. You can then store SQLDate in a CellTag as Russ suggested and change the sorting for the column to use the CellTag instead.

You obviously had a date object as dome point when you stuck the short date in the listbox. When you do that I would store Date.totalSeconds in the celltag and use that to sort that column in the CompareRows event.

  • karen

I also vote for using total seconds in CompareRows event.
Doing date parsing there is a waste of resources.

Actually. Yes that’s right. Total seconds is better for sorting.

There is an example of custom sorting in one if the webinars on the xojo site by the way.

Thanks for the help everyone! I’m going to check out the webinar.