Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdLCG-0008Qf-J0 for pgsql-general@arkaria.postgresql.org; Wed, 11 Jul 2018 19:54:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fdLCE-0006cv-Es for pgsql-general@arkaria.postgresql.org; Wed, 11 Jul 2018 19:54:42 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdLCE-0006co-7I for pgsql-general@lists.postgresql.org; Wed, 11 Jul 2018 19:54:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdLCB-0006DM-G7 for pgsql-general@postgresql.org; Wed, 11 Jul 2018 19:54:41 +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 w6BJsaAZ005403; Wed, 11 Jul 2018 15:54:36 -0400 From: Tom Lane To: David Gauthier cc: pgsql-general@postgresql.org Subject: Re: timestamp (military) at time zone without the suffix In-reply-to: References: Comments: In-reply-to David Gauthier message dated "Wed, 11 Jul 2018 15:36:01 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5401.1531338876.1@sss.pgh.pa.us> Date: Wed, 11 Jul 2018 15:54:36 -0400 Message-ID: <5402.1531338876@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Gauthier writes: > sqfdev=> select now()::timestamp(0) at time zone 'utc' ; > timezone > ------------------------ > 2018-07-11 11:27:12-04 > (1 row) You're doing it wrong: coercing to timestamp already involves a rotation to local time, and then "at time zone" says to interpret that as a time in UTC, and the output is a timestamptz which will be displayed in your local time. I think the result you want is more like select (now() at time zone 'utc')::timestamp(0); although personally I'd choose some other way of dropping the fractional second, probably select current_timestamp(0) at time zone 'utc'; regards, tom lane