|  03-18-2022, 10:55 AM | #1 | 
| Member  Posts: 22 Karma: 10 Join Date: Jul 2017 Device: none | 
				
				Calculate difference on two dates
			 
			
			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. | 
|   |   | 
|  03-18-2022, 11:12 AM | #2 | |
| Grand Sorcerer            Posts: 12,525 Karma: 8065948 Join Date: Jan 2010 Location: Notts, England Device: Kobo Libra 2 | Quote: 
 You probably want a template like this, with the lookup names changed appropriately. Code: program:
    days_between($$#read_end, $$#read_start)Code: program:
    floor(days_between($$#read_end, $$#read_start))Code: program:
    round(days_between($$#read_end, $$#read_start)) | |
|   |   | 
|  03-18-2022, 11:18 AM | #3 | 
| Member  Posts: 22 Karma: 10 Join Date: Jul 2017 Device: none | 
			
			Thanks, I'll look into it and get back to you if I can't get it to work.
		 | 
|   |   | 
|  03-18-2022, 05:06 PM | #4 | 
| Member  Posts: 22 Karma: 10 Join Date: Jul 2017 Device: none | 
			
			I think I don't understand something. I have copied in the templates and changed for me and have specified the template in the column. Shouldn't it actually work then? Please excuse my stupidity   | 
|   |   | 
|  03-18-2022, 05:28 PM | #5 | 
| Custom User Title            Posts: 11,331 Karma: 79528341 Join Date: Oct 2018 Location: Canada Device: Kobo Libra H2O, formerly Aura HD | Code: program: Lesedaeur() | 
|   |   | 
|  03-18-2022, 05:30 PM | #6 | 
| Member  Posts: 22 Karma: 10 Join Date: Jul 2017 Device: none | |
|   |   | 
|  03-18-2022, 05:43 PM | #7 | 
| Member  Posts: 22 Karma: 10 Join Date: Jul 2017 Device: none | 
			
			With some experimenting it worked now, thank you.
		 | 
|   |   | 
|  03-18-2022, 06:12 PM | #8 | 
| Custom User Title            Posts: 11,331 Karma: 79528341 Join Date: Oct 2018 Location: Canada Device: Kobo Libra H2O, formerly Aura HD | 
			
			If it helps for the future, I've found most of my days_between() errors happened because I put the two dates in the wrong order.
		 | 
|   |   | 
|  03-19-2022, 11:25 AM | #9 | 
| Member  Posts: 22 Karma: 10 Join Date: Jul 2017 Device: none | 
			
			Me again. Is it perhaps also possible that the field is only populated when Read Begin and Read End are filled in? At the moment there is always a 0 entered. Thanks in advance for the effort. | 
|   |   | 
|  03-19-2022, 11:51 AM | #10 | |
| Custom User Title            Posts: 11,331 Karma: 79528341 Join Date: Oct 2018 Location: Canada Device: Kobo Libra H2O, formerly Aura HD | Quote: 
 Code: program: if $$#date1 && $$#date2 then days_between($$#date1, $$#date2) fi Last edited by ownedbycats; 03-19-2022 at 02:01 PM. | |
|   |   | 
|  03-20-2022, 02:27 PM | #11 | 
| Guru            Posts: 917 Karma: 810834 Join Date: Sep 2017 Location: Buenos Aires, Argentina Device: moon+ reader, kindle paperwhite | 
			
			I have it configured like this Taking the start and read ended column Code: program: format_number(days_between(raw_field('#finished'), raw_field('#started')),"{0:5.0f}") | 
|   |   | 
|  03-20-2022, 03:18 PM | #12 | 
| Member  Posts: 22 Karma: 10 Join Date: Jul 2017 Device: none | 
			
			Thank you. Worked. Slowly it becomes as desired. I also have books that I have read but have not set a date. Is it perhaps also possible to write an unknown for these in Read Start, Read End and read duration? Last edited by quarkpott; 03-20-2022 at 03:29 PM. | 
|   |   | 
|  03-20-2022, 03:31 PM | #13 | 
| Member  Posts: 22 Karma: 10 Join Date: Jul 2017 Device: none | 
			
			That would be the last one, sorry for all the questions.
		 | 
|   |   | 
|  03-20-2022, 04:07 PM | #14 | 
| Member  Posts: 22 Karma: 10 Join Date: Jul 2017 Device: none | 
			
			Got it myself, thanks anyway for all the help here
		 | 
|   |   | 
|  03-20-2022, 04:10 PM | #15 | 
| Guru            Posts: 917 Karma: 810834 Join Date: Sep 2017 Location: Buenos Aires, Argentina Device: moon+ reader, kindle paperwhite | 
			
			They appear to me like this, like the image The columns I have are: Status (Read, To Read, Reading) Title Author Date (From Calibre) Ranking Tags Serie Editorial Published Pages Started (Read start date) Finished (Date the reading finished) Days (Number of days to read it) | 
|   |   | 
|  | 
| Thread Tools | Search this Thread | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Result of difference between two dates populated in a column | China Diapers | Calibre | 8 | 07-07-2019 04:53 AM | 
| Calculate reading time. | dunhill | Library Management | 12 | 12-12-2018 02:10 PM | 
| How does Kobo calculate reading statistics? | Mrs_Often | Kobo Reader | 24 | 10-30-2015 03:08 AM | 
| Is there any way to calculate page numbers better for H2O? | OrangeFlavored | Kobo Reader | 3 | 10-19-2014 06:10 PM |