it is written edit: nowdate() == doc.appointment_date the problem is how to subtract or add (before or after days)