![]() |
#1 |
Member
![]() Posts: 21
Karma: 10
Join Date: May 2011
Device: PRS-600
|
Result of difference between two dates populated in a column
I have added two custom columns to Calibre, 'Start' and 'Finish', both hold date values. I want to calculate the number of days difference between these two date values and populate this in a third column.
Is this possible? |
![]() |
![]() |
![]() |
#2 |
Deviser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
|
Yes, if you create a template function to do so.
See: https://manual.calibre-ebook.com/template_lang.html Create a custom composite column to test templates. Once you have the column, you can change its template simply by double-clicking on the column. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Member
![]() Posts: 21
Karma: 10
Join Date: May 2011
Device: PRS-600
|
Quote:
|
|
![]() |
![]() |
![]() |
#4 | |
Member
![]() Posts: 21
Karma: 10
Join Date: May 2011
Device: PRS-600
|
Quote:
days_between({#start_date},{#end_date}) returns "days_between(,)" days_between(#start_date,#end_date) returns "days_between(#start_date,#end_date)" What am I doing wrong? Last edited by China Diapers; 07-06-2019 at 01:21 PM. |
|
![]() |
![]() |
![]() |
#5 | |
Member
![]() Posts: 21
Karma: 10
Join Date: May 2011
Device: PRS-600
|
If I populate the template field with an example from the manual, e.g. :
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,721
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
@China Diapers - a search in MR for days_between found me this ==>> https://www.mobileread.com/forums/sh...15&postcount=6
BR |
![]() |
![]() |
![]() |
#7 | ||
Member
![]() Posts: 21
Karma: 10
Join Date: May 2011
Device: PRS-600
|
Quote:
Quote:
Code:
days_between(field('#start_date'),field('#end_date')); Last edited by China Diapers; 07-07-2019 at 04:32 AM. |
||
![]() |
![]() |
![]() |
#8 |
null operator (he/him)
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21,721
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
See Using general program mode
Code:
program:
days_between(field('#start_date'),field('#end_date'));
|
![]() |
![]() |
![]() |
#9 | |
Member
![]() Posts: 21
Karma: 10
Join Date: May 2011
Device: PRS-600
|
Quote:
I have returned to using calibre after a few years, had no idea how powerful it is. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding custom column with any lookup-name gives me empty column as a result? | Ahu Lee | Library Management | 16 | 06-09-2019 12:14 PM |
Using "Build column from other column" custom-column type | HFC3 | Library Management | 3 | 07-07-2013 03:11 AM |
Date column giving me incorrect result | James76 | Library Management | 3 | 12-22-2011 09:24 PM |
North America was populated by no more than 70 people 14,000 years ago | ardeegee | Lounge | 2 | 05-11-2011 07:33 PM |
Ebook-convert.exe and Win/Mac result difference | marekl | Calibre | 5 | 01-19-2011 03:18 PM |