public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Ron Johnson <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Forcing INTERVAL days display, even if the interval is less than one day
Date: Tue, 07 May 2024 12:57:33 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CANzqJaCt-mX2-AzF1j8mRr1xj95_y3JJk=0JHuvn24XDwW3jhg@mail.gmail.com>
References: <CANzqJaCt-mX2-AzF1j8mRr1xj95_y3JJk=0JHuvn24XDwW3jhg@mail.gmail.com>

Ron Johnson <[email protected]> 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






reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Forcing INTERVAL days display, even if the interval is less than one day
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox