This sounds like an application design problem. You should not store data in its representative form (ie a string) if there is a native form for the data. You should instead store the data as date type (assuming it is a property, use DateTime objects if not) and format it as desired when you render it. Then you can sort it, and change the formatting (or use multiple formats) easily. Now assuming you cannot do this, here is a hack solution to your problem, write a python script as follows: obs = [] for kube in context.objectValues('Kube'): day, month, year = content_creation_date.split('/') obs.append((int(year), int(month), int(day), kube.getId())) obs.sort() return [context[id] for year, month, day, id in obs] Here's how it works: Step through each Kube object, extracting the day month and year from the creation date. Then append a tuple with the date information as ints in the proper order for sorting (year, month, day) plus the id of the Kube so we can get it back out at the end. Then sort this list of tuples (The Python sort method does the right thing for us here). The last line uses a list incomprehension to make a new list of Kubes in order by date by pulling the ids out of the tuples and looking them up in the context. The only hangup would be if content_creation_date is not a string or contains things other than integers in the date field or is not consistently formatted. If its the latter, you're probably SOL. If this is too slow, you could use ZCatalog to speed it up, by calculating a real DateTime from the content_creation_date and indexing against it. Then you can sort by the index. hth, -Casey On Wednesday 21 August 2002 06:24 am, Patrick Romano wrote:
I want to sort a certain number of Kubes by their content creation date, which is DD/MM/YY, but if I do it like that
<dtml-in expr="news.objectValues('Kube')" sort="content_creation_date">
the Kubes are sorted by date starting from the left : sorted by DD first. How can I achieve to have it soted by YY without changing the order of my date (DD/MM/YY)?
Thanks, Patrick