Re: current_date / datetime stuff

Поиск
Список
Период
Сортировка
От Rodrigo De León
Тема Re: current_date / datetime stuff
Дата
Msg-id a55915760706040925n5c8286f9t7e11989ca22559ab@mail.gmail.com
обсуждение исходный текст
Ответ на current_date / datetime stuff  (Joshua <joshua@joshuaneil.com>)
Список pgsql-sql
On 6/4/07, Joshua <joshua@joshuaneil.com> wrote:
> Hello,
>
> I was hoping someone here may be able to help me out with this one:
>
> Is there anything similiar to:     SELECT current_date;
> that will return the date of the first Monday of the month?
>
> Please let me know.
>
> Thanks,
> Joshua

select ( select case i <= dow   when true  then d + (i - dow + 7)   when false then d + (i - dow) end from (   select d
 , extract(dow from d)::int as dow   , 1 as i -- monday   from (     select date_trunc('month',current_date)::date - 1
asd   ) q ) q2
 
) as first_monday_of_the_month


В списке pgsql-sql по дате отправления:

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: current_date / datetime stuff
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: current_date / datetime stuff