Re: Re: php, time and postgresql

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Re: php, time and postgresql
Дата
Msg-id 20010112162649.A23581@wolff.to
обсуждение исходный текст
Ответ на php, time and postgresql  (Rasmus Resen Amossen <spunk@rhk.dk>)
Список pgsql-general
On Fri, Jan 12, 2001 at 02:29:01PM -0700,
  Mark Lane <mlane@mynewthing.com> wrote:
> On Friday 12 January 2001 14:29, you wrote:
> > How about doing something like this:
> > bruno=> select 'epoch'::timestamp + '979333398 second';
> >         ?column?
> > ------------------------
> >  2001-01-12 15:03:18-06
> >
> I Think that is an interesting way of converting unixtime to a timestamp but
> I think he wants to save the time as 979333398 seconds. That would allow him
> to easily convert it to any date/time format when he retrieves it from the
> Database It would also allow for faster sorting if he stored the information
> as an int.

I don't see how storing the time in seconds helps. Once you do that you
can't use the to_date functions to format the output. I also don't see
gaining much in terms of speed either. Timestamps are wider than ints,
but are going to be fast to work with.

While looking for ideas about this I noticed a lack of to_date functions for
printing intervals. I think it would be nice to be able to do something like
the following:
select to_char(now() - 'epoch', 'SSSSSSSSSSSSS');
and get the result:
979333398

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] problems with pg_geqo
Следующее
От: Jeffery L Post
Дата:
Сообщение: Re: Time Formats