get the logs of the current week in postgresql

Use date_trunc():

select *
from dolar_euro
where fecha_registro >= date_trunc('week', current_date)

Note: Postgres understand weeks as defined by ISO, meaning that a week starts on Monday.

If your table may contain dates in the future, you might want an upper bound too:

select *
from dolar_euro
where fecha_registro >= date_trunc('week', current_date)
  and fecha_registro <  date_trunc('week', current_date) + interval '1 week'

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top