Re: selecting timestamp

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: selecting timestamp
Дата
Msg-id CAKFQuwZ3DYbuFwP+HAmEyPcf29adBFHJ5ME4jSOWzeuhnwN5cA@mail.gmail.com
обсуждение исходный текст
Ответ на selecting timestamp  (chris <chrisk@pgsqlrocket.com>)
Ответы Re: selecting timestamp
Список pgsql-general
On Tue, Feb 27, 2018 at 1:16 PM, chris <chrisk@pgsqlrocket.com> wrote:

What is the best way of selecting current timestamp in UTC? 

​You
​ haven't​
 define
​d​
criteria upon which to judge - and the list below is not exhaustive
​ (but sufficiently so)​

SELECT
CURRENT_TIMESTAMP   as ct1

standard conforming, ​assumes server configured for UTC
 
,timezone('UTC',CURRENT_TIMESTAMP) as ct2
,timezone('utc',now()) as ct3

​non-standard, personally non-obvious (the function looks like an implementation detail that should be avoided)​

,CURRENT_TIMESTAMP at time zone 'UTC' as ct4

​This -​

standard conforming and doesn't require assumptions about the calling environment

,NOW() at time zone 'utc' as ct5

​non-standard but frequently used; no semantic different compared to the previous entry
David J.


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: selecting timestamp
Следующее
От: Joe Conway
Дата:
Сообщение: Re: selecting timestamp