From: 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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, op12om@yahoo.co.in, pgsql-sql@postgresql.org
Subject: Re: Getting wrong time using now()
In-Reply-To: <16352.1550015207@sss.pgh.pa.us>
References: <747290055.2254380.1550014566188.ref@mail.yahoo.com> <747290055.2254380.1550014566188@mail.yahoo.com> <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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox