Two things I can think of offhand.
- If you are using { } to enclose your sql query instead of " ", it will not substitute $date into your sql query. It will literally use $date.
- You need to make sure $date is in timestamp/date format.
to_char(timestamp($date, 'YYYY-MM-DD') + '7 days'::interval,'YYYY-MM-DD') as next_weeks_date
I think I got the syntax correct.