Instead of assigning all these variables, you could use something like `get_date(offset)` inside your query.