Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s4O8N-003Ojn-KB for pgsql-general@arkaria.postgresql.org; Tue, 07 May 2024 16:57:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s4O8K-0041jD-Mm for pgsql-general@arkaria.postgresql.org; Tue, 07 May 2024 16:57:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s4O8K-0041j3-Ao for pgsql-general@lists.postgresql.org; Tue, 07 May 2024 16:57:41 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s4O8F-001tvJ-40 for pgsql-general@postgresql.org; Tue, 07 May 2024 16:57:39 +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 447GvXTk4130720; Tue, 7 May 2024 12:57:33 -0400 From: Tom Lane To: Ron Johnson cc: pgsql-general Subject: Re: Forcing INTERVAL days display, even if the interval is less than one day In-reply-to: References: Comments: In-reply-to Ron Johnson message dated "Tue, 07 May 2024 11:08:47 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4130718.1715101053.1@sss.pgh.pa.us> Date: Tue, 07 May 2024 12:57:33 -0400 Message-ID: <4130719.1715101053@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ron Johnson writes: > PG 9.6.24, if relevant. (Hopefully we're migrating next month.) > Displaying how long ago a date was is easy, but interval casts "helpfully" > suppress "X days ago" if the interval is less than one day ago. > How do I make it display "days ago", even when days ago is zero? > Explicitly casting "day to second" didn't work. to_char() could be your friend here. regards, tom lane