Re: timezone() with timeofday() converts the wrong direction?

Поиск
Список
Период
Сортировка
От Steve - DND
Тема Re: timezone() with timeofday() converts the wrong direction?
Дата
Msg-id LDEHKBBOEMIJKHKBOFNFKEHONGAA.postgres@digitalnothing.com
обсуждение исходный текст
Ответ на Re: timezone() with timeofday() converts the wrong direction?  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: timezone() with timeofday() converts the wrong direction?  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
>
> Again looking at the documentation, we see that "timestamp with
> time zone AT TIME ZONE zone" means "Convert UTC to local time in
> given time zone" and has a return type of "timestamp without time
> zone".  So if we run the above command without the final cast
> around 16:25 PDT / 23:25 UTC, we get this:
>
> SELECT timezone('UTC', timeofday()::timestamptz);
>           timezone
> ----------------------------
>  2005-04-21 23:25:12.868212
> (1 row)
>
> This result is a "timestamp without time zone", so there's no
> indication that it's UTC or PDT or anything else.  Since it has no
> time zone, casting it to timestamptz puts it in your local time
> zone:
>
> SELECT '2005-04-21 23:25:12.868212'::timestamptz;
>           timestamptz
> -------------------------------
>  2005-04-21 23:25:12.868212-07
> (1 row)

Okay, I understand what you're saying now, but then is a time without a
timezone implicitly assumed to be UTC? Is there a way to explicitly make the
timezone on the stamp be UTC, if the prior is not the case?

Steve



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

Предыдущее
От: Carlos Correia
Дата:
Сообщение: Record as a parameter to a function
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Record as a parameter to a function