Re: Getting wrong time using now()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Getting wrong time using now()
Дата
Msg-id 16352.1550015207@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Getting wrong time using now()  (Om Prakash Jaiswal <op12om@yahoo.co.in>)
Список pgsql-general
Om Prakash Jaiswal <op12om@yahoo.co.in> writes:
> Create table service_record(Id into, time timestamp without time zone default now()).Postgresql version 9.6.6,
RHEL7.6, when I am executing the query. I am getting time 5:30hours behind current time. Please solve it 

Well, you probably ought to be using LOCALTIMESTAMP, not now(),
as the initializer for a "timestamp without time zone" value,
if only to save a useless runtime datatype conversion.  See

https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT

However, if the results don't look right to you, it probably
means that you don't have the timezone parameter set correctly.

            regards, tom lane


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Getting wrong time using now()
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: Subquery to select max(date) value