View Single Post
Old 03-18-2022, 11:12 AM   #2
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,471
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by quarkpott View Post
Hello,

Maybe someone can help me.
I have a Read Start column and a Read End column. How can I create a read duration column that shows the days between the two dates? How can I create a read duration column that shows the days between the two dates?
I need a column that depends on other columns, but then unfortunately I do not get more.

I would be very glad about help.
See The calibre template language, General Program Mode, and in particular the days_between() function.

You probably want a template like this, with the lookup names changed appropriately.
Code:
program:
    days_between($$#read_end, $$#read_start)
The days_between() function returns fractional days. If you want an integer then use either
Code:
program:
    floor(days_between($$#read_end, $$#read_start))
Code:
program:
    round(days_between($$#read_end, $$#read_start))
chaley is offline   Reply With Quote