Ecto Query - Dates + Postgres Intervals + Query Interpolation
I would like to create an Ecto query that filters records in a children table by their age (i.e. "minimum age (months) -> maximum age (months)". One simple way to do this would be the Ecto date_add feature: from c in Child, where: c.birthday > datetime_add(^Ecto.DateTime.utc, -1, "month") The issue with this is that not all children will be on the same time zone, and certainly not all on Etc/UTC . This query would be pretty close, but not spot on (some would be off by a day). I've been trying to use PostgreSQL's interval functionality to make this query work. I can get it to work using an SQL