| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "op12om(at)yahoo(dot)co(dot)in" <op12om(at)yahoo(dot)co(dot)in> |
| Cc: | Postgres General <pgsql-general(at)postgresql(dot)org>, Postgres List <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: Getting wrong time using now() |
| Date: | 2019-02-12 23:46:47 |
| Message-ID: | 16352.1550015207@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general pgsql-sql |
Om Prakash Jaiswal <op12om(at)yahoo(dot)co(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rich Shepard | 2019-02-12 23:48:38 | Re: Subquery to select max(date) value |
| Previous Message | Adrian Klaver | 2019-02-12 23:40:50 | Re: Getting wrong time using now() |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | github kran | 2019-02-13 15:49:38 | Re: Postgresql RDS DB Latency Chossing Hash join Plan |
| Previous Message | Adrian Klaver | 2019-02-12 23:40:50 | Re: Getting wrong time using now() |