Re: How to specify the beginning of the month in Postgres SQL syntax?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How to specify the beginning of the month in Postgres SQL syntax?
Дата
Msg-id 6552.1071071508@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: How to specify the beginning of the month in Postgres SQL syntax?  ("sqllist" <sqllist@coralindia.com>)
Список pgsql-sql
"sqllist" <sqllist@coralindia.com> writes:
> WHERE date < to_date( to_char(current_date,'yyyy-MM') || '-01','yyyy-mm-dd')

That seems like the hard way.  Try this:

regression=# select date_trunc('month', now());      date_trunc
------------------------2003-12-01 00:00:00-05
(1 row)
        regards, tom lane


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

Предыдущее
От: DHS Webmaster
Дата:
Сообщение: first of month
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to completely move a table to another schema?