agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Tom Lane <tgl@sss.pgh.pa.us>
To: op12om@yahoo.co.in <op12om@yahoo.co.in>
Cc: Postgres General <pgsql-general@postgresql.org>
Cc: Postgres List <pgsql-sql@postgresql.org>
Subject: Re: Getting wrong time using now()
Date: Tue, 12 Feb 2019 18:46:47 -0500
Message-ID: <16352.1550015207@sss.pgh.pa.us> (raw)
In-Reply-To: <747290055.2254380.1550014566188@mail.yahoo.com>
References: <747290055.2254380.1550014566188.ref@mail.yahoo.com>
<747290055.2254380.1550014566188@mail.yahoo.com>
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
view thread (3+ messages)
Message-ID: <16352.1550015207@sss.pgh.pa.us>
Permalink: ../16352.1550015207@sss.pgh.pa.us/
Also on: postgresql.org/message-id/16352.1550015207@sss.pgh.pa.us
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, op12om@yahoo.co.in, pgsql-general@postgresql.org
Subject: Re: Getting wrong time using now()
In-Reply-To: <16352.1550015207@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox