Answer the question
In order to leave comments, you need to log in
How to get dates that match the names of the days of the week in Postgresql?
I have start date, end date and day names.
It is required to find all dates between the beginning and the end that will be on this day.
That is, you need to determine all the dates in the period when it will be Friday or Tuesday.
How can this be done?
Answer the question
In order to leave comments, you need to log in
select day /*, ... */
from tablename
join lateral generate_series(start_date, end_date, interval '1day') as day on true
where to_char(day, 'Day') = week_day
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question