Обсуждение: Error in date_part epoch docs.

Поиск
Список
Период
Сортировка

Error in date_part epoch docs.

От
"Christopher Kings-Lynne"
Дата:
This one had me worried for a while:

From functions-datetime.html...

epoch
For date and timestamp values, the number of seconds since 1970-01-01
00:00:00 (Result may be negative.); for interval values, the total number of
seconds in the interval

This is incorrect, it's from 1970-01-01 08:00:00

eg:

australia=# select date_part('epoch', '1970-01-01 08:00:00'::timestamp);
 date_part
-----------
         0
(1 row)

australia=# select date_part('epoch', '1970-01-01 00:00:00'::timestamp);
 date_part
-----------
    -28800
(1 row)

This is a trivial change so I won't bother submitting a patch...

Chris


Re: Error in date_part epoch docs.

От
Thomas Lockhart
Дата:
> >From functions-datetime.html...
> epoch
> For date and timestamp values, the number of seconds since 1970-01-01
> 00:00:00 (Result may be negative.); for interval values, the total number of
> seconds in the interval
> This is incorrect, it's from 1970-01-01 08:00:00

Actually, it is from 1970-01-01 00:00:00 GMT. I'll clarify the docs.
Thanks for the note.

                 - Thomas

Re: Error in date_part epoch docs.

От
"Christopher Kings-Lynne"
Дата:
Oooh.  Now that's an interesting point!  That's going to play merry havoc
with our code.  Is there a way of GMT'ing everything?

Chris

> -----Original Message-----
> From: lockhart@fourpalms.org [mailto:lockhart@fourpalms.org]
> Sent: Tuesday, 25 September 2001 1:41 PM
> To: Christopher Kings-Lynne
> Cc: pgsql-docs@postgresql.org
> Subject: Re: [DOCS] Error in date_part epoch docs.
>
>
> > >From functions-datetime.html...
> > epoch
> > For date and timestamp values, the number of seconds since 1970-01-01
> > 00:00:00 (Result may be negative.); for interval values, the
> total number of
> > seconds in the interval
> > This is incorrect, it's from 1970-01-01 08:00:00
>
> Actually, it is from 1970-01-01 00:00:00 GMT. I'll clarify the docs.
> Thanks for the note.
>
>                  - Thomas
>


Re: Error in date_part epoch docs.

От
Thomas Lockhart
Дата:
> Oooh.  Now that's an interesting point!  That's going to play merry havoc
> with our code.  Is there a way of GMT'ing everything?

Not sure what you mean. All timestamps are stored in GMT, and are
converted to your local time zone when sent to your client. You can set
your server to be using GMT, or you can set the time zone from your
client, or you can use it as intended ;)

The next release (7.2) will have two timestamp types, the one you have
now and one without time zones of any kind. But I'd recommend
understanding and using time zones in your application to avoid
restrictions and missing functionality later on.

Anyway, why would having time zones cause trouble for your code?

                          - Thomas