View Single Post
Old 05-07-2015, 03:58 PM   #16
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,465
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Phssthpok View Post
The only issue I have now is that the result of all this is a string. Is there any way to turn it back into a datetime and format it nicely for display while sorting it only the underlying datetime value? datetime.strptime() would presumably do the trick if only I could import datetime somehow...

But this would just be the icing on the cake... as it is, your solution does exactly what I wanted. Thank you very much.
All composite custom columns (columns built from other columns) are in the end string values. However, if you set the column to sort by date, calibre will try to determine the underlying date and sort it correctly. For example, it will almost certainly recognize dd/mm/yy formatted dates, taking into consideration the locale to know whether the date is dd/mm or mm/dd.
chaley is offline   Reply With Quote