Re: Formatting problems with negative intervals, TO_CHAR - Mailing list pgsql-sql

From Stefan Weiss
Subject Re: Formatting problems with negative intervals, TO_CHAR
Date
Msg-id 200406071108.37410.spaceman@foo.at
Whole thread Raw
In response to Re: Formatting problems with negative intervals, TO_CHAR  (Karel Zak <zakkr@zf.jcu.cz>)
Responses Re: Formatting problems with negative intervals, TO_CHAR  (Karel Zak <zakkr@zf.jcu.cz>)
List pgsql-sql
On Monday, 07 June 2004 09:52, Karel Zak wrote:
>   http://www.postgresql.org/docs/7.4/static/functions-formatting.html
>
>   Warning: to_char(interval, text) is deprecated and should not be
>   used in newly-written code. It will be removed in the next version.

This is news for me. Are there any suggestions what we should replace
TO_CHAR with? For example, we were using TO_CHAR to print timestamp
values in ISO format without milliseconds ("YYYY-MM-DD HH24:MI:SS" style), 
regardless of the current datestyle setting.

I see only three solutions to do this without using TO_CHAR, and IMO none
of them are very attractive:
- do the formatting at the application level,- change the datestyle for this query only- an ugly construct using 6
EXTRACTfunctions
 

I hope there is a more elegant way to solve this...

Why was TO_CHAR deprecated anyway? It seemed to me like a very useful and
flexible way to do date/time formatting.


Tnx,
stefan


pgsql-sql by date:

Previous
From: Karel Zak
Date:
Subject: Re: Formatting problems with negative intervals, TO_CHAR
Next
From: Karel Zak
Date:
Subject: Re: Formatting problems with negative intervals, TO_CHAR