code to calculate days from a reference time to most recent activity