Re: Forcing INTERVAL days display, even if the interval is less than one day - Mailing list pgsql-general

From Tom Lane
Subject Re: Forcing INTERVAL days display, even if the interval is less than one day
Date
Msg-id 4130719.1715101053@sss.pgh.pa.us
Whole thread Raw
In response to Forcing INTERVAL days display, even if the interval is less than one day  (Ron Johnson <ronljohnsonjr@gmail.com>)
List pgsql-general
Ron Johnson <ronljohnsonjr@gmail.com> 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



pgsql-general by date:

Previous
From: Siddharth Jain
Date:
Subject: Re: Question regarding how databases support atomicity
Next
From: Tom Lane
Date:
Subject: Re: Question regarding how databases support atomicity