Extract dates of a given day

From: hmidi slim <hmidi(dot)slim2(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Extract dates of a given day
Date: 2018-04-06 10:32:41
Message-ID: CAMsqVxtCJzovZrXd17_cC-BoYC+JPGm38rmCH12o+fhrYX4bzg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I have a table availability: id (integer), product varchar(255), period
(daterange)
I want to extract dates from a given period matching a given day.
E.g: for the period from *01/04/2018 - 30/04/2018* and for *day = Monday*
I want to get

*02/04/201809/04/201816/04/201823/04/201830/04/2018*

I want to make a query such as (the query doesn't work ) but I want to
extract dates from daterange type:
select * from availability
where period @> '[2018-04-02, 2018-04-20]'
and extract(dow from period_date) = 1

How can I extract dates from daterange?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message mariusz 2018-04-06 12:19:42 Re: Extract dates of a given day
Previous Message Laurenz Albe 2018-04-06 06:24:56 Re: pg_basebackup or dump for starting replication process