select * from tablename where  DATEDIFF(day, time, getdate())>5