Re: Forcing INTERVAL days display, even if the interval is less than one day

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Forcing INTERVAL days display, even if the interval is less than one day
Дата
Msg-id 4130719.1715101053@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Forcing INTERVAL days display, even if the interval is less than one day  (Ron Johnson <ronljohnsonjr@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Siddharth Jain
Дата:
Сообщение: Re: Question regarding how databases support atomicity
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Question regarding how databases support atomicity