Re: [NOVICE] to_days(now())

Поиск
Список
Период
Сортировка
От Joel Burton
Тема Re: [NOVICE] to_days(now())
Дата
Msg-id 3A2BB8D9.12561.12339D5@localhost
обсуждение исходный текст
Ответы Re: Re: [NOVICE] to_days(now())  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-general
On 28 Nov 2000, at 13:12, Brian Aker wrote:

> I've been looking for a good reference for the built
> in time functions and have yet to find any.

Try the functions reference in the postgresql manual--there's a lot of
information about Pgsql date/time functions there, but in your case, no
function is needed--overloaded operators will work fine.

> What I really need is something similar to MySQL's:
> select to_days(now());
>
> This returns the number of days since year one from
> the current time in the database.
> Thanks for any help in advance (please CC  me directly
> since I don't subscribe to this mailing list).

select yourdate - '0000-01-01'::date from yourtable;

seems to work just fine, and returns an integer.

Both PostgreSQL and MySQL say there have been  730485 between 1/1/0
and 1/1/2000. Something we all can agree on? :-)

Good luck w/your app,

--
Joel Burton, Director of Information Systems -*- jburton@scw.org
Support Center of Washington (www.scw.org)

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

Предыдущее
От: "Alistair Hopkins"
Дата:
Сообщение: RE: Built in Functions use with recordsets
Следующее
От: "JB"
Дата:
Сообщение: Re: [PHP] RE: [SQL] a script that queries database periodically