Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lbQ4c-0001pb-UP for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Apr 2021 15:56:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lbQ4b-0001kY-PF for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Apr 2021 15:56:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lbQ4b-0001kR-IE for pgsql-hackers@lists.postgresql.org; Tue, 27 Apr 2021 15:56:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lbQ4Z-0005BF-Ay for pgsql-hackers@postgresql.org; Tue, 27 Apr 2021 15:56:28 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 13RFuMn02658908; Tue, 27 Apr 2021 11:56:22 -0400 From: Tom Lane To: Peter Eisentraut cc: David Steele , Pavel Stehule , Thomas Munro , Petr Fedorov , pgsql-hackers Subject: Re: Since '2001-09-09 01:46:40'::timestamp microseconds are lost when extracting epoch In-reply-to: <1197050.1619123213@sss.pgh.pa.us> References: <1551357.1599435992@sss.pgh.pa.us> <097a4242-0748-98e3-06ab-ded1d366cd76@2ndquadrant.com> <1893468.1599658711@sss.pgh.pa.us> <38fc499a-ae52-efb6-aad6-82f812d6782d@2ndquadrant.com> <20200917055327.GU2873@paquier.xyz> <20200930071543.GL1996@paquier.xyz> <2fb99632-9302-6509-78ce-3aaed3fd7f40@2ndquadrant.com> <3ff4be02-1e2b-564f-9b53-3dc561da8218@pgmasters.net> <3013402.1615829712@sss.pgh.pa.us> <8fae8673-0d5b-12d9-7342-daed0d590594@2ndquadrant.com> <901bcfb8-36c8-27b2-b148-042392992eeb@2ndquadrant.com> <4158031.1616184417@sss.pgh.pa.us> <75db3efe-8023-58ef-9ee4-8a6a3101c7ca@2ndquadrant.com> <226163.1618847845@sss.pgh.pa.us> <1197050.1619123213@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 22 Apr 2021 16:26:53 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2658906.1619538982.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 27 Apr 2021 11:56:22 -0400 Message-ID: <2658907.1619538982@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: >> Perhaps it'd be worth documenting that you can get the standard >> astronomical definition of Julian date by transposing to time zone UTC-= 12 >> before converting. BTW ... I'd first thought that the way to do this was to rotate to time zone UTC+12. I convinced myself on two separate days that UTC-12 was correct instead, but now I'm thinking I was right the first time. In particular, the results I'm getting with UTC-12 don't square with the example on Wikipedia [1], which says "the Julian Date for 00:30:00.0 UT January 1, 2013, is 2 456 293.520 833": regression=3D# select extract(julian from '2013-01-01 00:30+00'::timestamp= tz at time zone 'utc-12'); extract = ------------------------------ 2456294.52083333333333333333 (1 row) But using UTC+12 does match: regression=3D# select extract(julian from '2013-01-01 00:30+00'::timestamp= tz at time zone 'utc+12'); extract = ------------------------------ 2456293.52083333333333333333 (1 row) Of course Wikipedia has been known to contain errors, but now I'm inclined to think I blew this. Anyone want to check my work? regards, tom lane [1] https://en.wikipedia.org/wiki/Julian_day