Re: Getting wrong time using now()
Tom Lane <[email protected]> Tue, 12 Feb 2019 18:46:47 -0500
| Newsgroups | gmane.comp.db.postgresql.sql,gmane.comp.db.postgresql.general |
|---|---|
| Message-ID | <[email protected]> |
Om Prakash Jaiswal <[email protected]> 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