Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gthlO-0008Fw-4W for pgsql-sql@arkaria.postgresql.org; Tue, 12 Feb 2019 23:46:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gthlM-00052j-JW for pgsql-sql@arkaria.postgresql.org; Tue, 12 Feb 2019 23:46:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gthlM-00052X-Bm; Tue, 12 Feb 2019 23:46:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gthlJ-00017m-Qm; Tue, 12 Feb 2019 23:46:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x1CNklQ0016353; Tue, 12 Feb 2019 18:46:47 -0500 From: Tom Lane To: "op12om@yahoo.co.in" cc: Postgres General , Postgres List Subject: Re: Getting wrong time using now() In-reply-to: <747290055.2254380.1550014566188@mail.yahoo.com> References: <747290055.2254380.1550014566188.ref@mail.yahoo.com> <747290055.2254380.1550014566188@mail.yahoo.com> Comments: In-reply-to Om Prakash Jaiswal message dated "Tue, 12 Feb 2019 23:36:06 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16351.1550015207.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 12 Feb 2019 18:46:47 -0500 Message-ID: <16352.1550015207@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Om Prakash Jaiswal writes: > Create table service_record(Id into, time timestamp without time zone de= fault now()).Postgresql version 9.6.6, RHEL7.6 , when I am executing the q= uery. 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