![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 882
Karma: 409970
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
|
Compute library book return date?
Hello people.
I have a library with a column with a loan date. Could you help me with a regular expression that calculates the date to be repaid from the date of the loan? While i keep doing tests |
![]() |
![]() |
![]() |
#2 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,404
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
What calculation do you want to do? Is it something like ("loan date" + 10 days)? |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 882
Karma: 409970
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
|
|
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,404
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#5 |
Custom User Title
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,884
Karma: 74203799
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
|
Unless you always borrow a book for the same duration, you'd probably want a second column with the length of the loan.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 608
Karma: 5007204
Join Date: Sep 2014
Location: Calif
Device: Fire hdx 8.9, Tab S2, Tab S5e, Aura ONE
|
Do not believe possible. My local library has a "normal" due date of 3 weeks from date of marking the book for loan & available for download. Then there are also many books that is for loan for just 2 weeks; another case is the the loan time is from a library in the consortium or borrowed from a university by the local library where the loan date is marked as available for download.
So which due date will anyone want the Calibre to "calculate"? |
![]() |
![]() |
![]() |
#7 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 882
Karma: 409970
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
|
Quote:
#fechaprestamo = Loan date #diasadevolver = Number of days (manual loading) #adevolver = Date that would have to be returned Moderator Notice
Edited to make the screen captures comply with forum rules. Last edited by chaley; 05-31-2021 at 06:36 PM. |
|
![]() |
![]() |
![]() |
#8 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 882
Karma: 409970
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
|
Quote:
|
|
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,404
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Moderator Notice
Moved posts to a separate thread |
![]() |
![]() |
![]() |
#10 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 608
Karma: 5007204
Join Date: Sep 2014
Location: Calif
Device: Fire hdx 8.9, Tab S2, Tab S5e, Aura ONE
|
I don't have any config for the "due date"; do not see the need for it nor do care; an advanatage of being retired & "on vacation" every day. I read the book after getting it then return it before it is due. Or my library sends a notice a few days before the need to return; did miss once as the email-id was off by 1 character by them.
Only problem occurs when multiple books were reserved & all of the books are available at the same time. Good thing for having multiple tablets so can read multiple books opened at the same time. |
![]() |
![]() |
![]() |
#11 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,404
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#12 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 882
Karma: 409970
Join Date: Sep 2017
Location: Buenos Aires, Argentina
Device: moon+ reader, kindle paperwhite
|
Quote:
Code:
#fechaprestamo (a date) + #diasadevolver (Manually entered in column) = #adevolver (a computed date) Last edited by dunhill; 06-01-2021 at 06:48 PM. |
|
![]() |
![]() |
![]() |
#13 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,404
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
This should what you want, or at least close to it.
Code:
program: # Calculate number of seconds in a day one_day = 60 * 60 * 24; # Calculate total seconds for days of loan loan_seconds = one_day * $#diasadevolver; # Get the start date in ISO format start_day = $$#fechaprestamo; # Get the "timestamp" for the start date -- number of seconds since epoch start_ts = format_date(start_day, 'to_number'); # Add the number of seconds for the days of loan end_ts = start_ts + loan_seconds; # Convert the timestamp back into a datte end_ts = format_date(start_ts, 'from_number'); # Format the date as desired end_day = format_date(end_ts, 'yyyy MM dd') |
![]() |
![]() |
![]() |
#14 |
Chalut o/
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 439
Karma: 145424
Join Date: Dec 2017
Device: Kobo
|
small error in
Code:
# Convert the timestamp back into a datte end_ts = format_date(start_ts, 'from_number'); |
![]() |
![]() |
![]() |
#15 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,404
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
There is an optimization available. 'from_number' also accepts the date format, so you can use: Code:
# Convert the timestamp back into a datte # Format the date as desired format_date(end_ts, 'from_number:yyyy MM dd') Code:
program: # Calculate number of seconds in a day one_day = 60 * 60 * 24; # Calculate total seconds for days of loan loan_seconds = one_day * $#diasadevolver; # Get the start date in ISO format start_day = $$#fechaprestamo; # Get the "timestamp" for the start date -- number of seconds since epoch start_ts = format_date(start_day, 'to_number'); # Add the number of seconds for the days of loan end_ts = start_ts + loan_seconds; # Convert the timestamp back into a date # Format the date as desired format_date(end_ts, 'from_number:yyyy MM dd'); |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
date of adding book to my library is incorrect | judet | Library Management | 2 | 01-21-2014 12:47 PM |
Need to return to the library display | renzii | Library Management | 4 | 06-28-2013 06:53 PM |
Date Added column? Can I set date when book added to library? | fitzhugh | Calibre | 4 | 06-03-2012 05:42 PM |
Return Book to Library Early | Maggie-Me | Kindle Formats | 8 | 01-17-2011 10:43 AM |
Return Book to Library Early | Maggie-Me | General Discussions | 15 | 12-24-2010 08:58 PM |