Date between 2 dates

Skip to first unread message

Jan 15, 2023, 6:33:13 PMJan 15
to mementodatabase
I have a datbase I designed for holiday bookings and want to calculate the amount of nights stay  between the checkin day and checkout day, how is this done please

Stay 1
Checkin 12/5/2023     checkout 15/5/23      = 3nights
Stay 2 
checkin 15/5/2023     checkout  18/5/2023    = 3 Nights
Stay 3
Checkin 18/5/2023     checkout 26/5/2023     = 8 nights

Craig Hunter

Jan 15, 2023, 9:29:06 PMJan 15
to, mementodatabase
In memento javascript field you can try adding javascript library - "moment"

There's a lot to learn there, but it handles all the edge cases well. Leap years, timezones, ...

If you don't want javascript, a calculation field would be:
where d1 is the checkin date field, and d2 is the check out date field. The division is because dates are stored as seconds after a certain date.

Jan 15, 2023, 10:04:44 PMJan 15
to mementodatabase
thankyou craig much appreciated all good now

Bill Crews

Jan 16, 2023, 1:29:27 AMJan 16
to, mementodatabase
In Memento Help, under Calendar, it says this and gives an example...

Craig's that there's a lot to learn, both about moment.js and about data arithmetic in general, but so long as you stay in modern times, the following JavaScript field script will do just what you want...

((field("checkout").getTime() - field("check-in").getTime()) / (1000 * 60 * 60 * 24)).toFixed();

You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages