View Single Post
Old 12-28-2012, 01:47 PM   #4
bookworm2000
Member
bookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the rough
 
Posts: 14
Karma: 7220
Join Date: Dec 2012
Device: Kindle 4NT, Android
Thank you both for your answers.


Quote:
Originally Posted by Sabardeyn View Post
I've just found out about subgroups and think they might be of use in this instance: http://manual.calibre-ebook.com/sub_groups.html

The column containing the original data is already organized into subgroups.


Quote:
Originally Posted by chaley View Post
The following general program mode template does what I think you want.
Code:
program:
	date = field('#original_date');
# compute the components
	year = subitems(date, 0, 1);
	month = re(subitems(date, 1, 2), '^\D*$',  '00');
	day = ifempty(subitems(date, 2, 3), '00');
# compute the return value
	strcat(year, '--', month, '--', day)


That's exactly what I was looking for.



One last question:

I expanded the template to ISO 8601 format. Is there a way to convert this date string to datetime data type?

That would allow me to

a) sort the column by date instead of string,
b) use date formatting in further columns (e.g. used for display in the content server).

Or is that impossible because 1955-00-00T00:00:00Z+00:00 is not a valid date (with a 00 month and day)?
bookworm2000 is offline   Reply With Quote