Re: Getting 2002-12-18T17:32:40-05:00 (ISO 8601) from to_date()

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Gibbs <peter(at)emkel(dot)co(dot)za>, Karl DeBisschop <kdebisschop(at)alert(dot)infoplease(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Getting 2002-12-18T17:32:40-05:00 (ISO 8601) from to_date()
Date: 2002-12-23 09:38:11
Message-ID: 20021223093810.GA30081@zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, Dec 19, 2002 at 10:50:51AM -0500, Tom Lane wrote:
> "Peter Gibbs" <peter(at)emkel(dot)co(dot)za> writes:
> > select to_char(now()+'3 days'::interval,'YYYY-MM-DDTHH24:MI:SS');
> > to_char
> > -----------------------
> > 2002-12-22NDH24:41:58
>
> Oh, duh --- "TH" is a format modifier. That's what's confusing it
> (and today being the 19TH is what's confusing us).

# select to_char(now(),'DDth Mon YYYY');
to_char
---------------
23rd Dec 2002

> So the suggestion of ... DD"T"HH ... is the way to go.

Right, Tom read docs :-).

Please, use it in always if you want to put non-format modifier into
formatting strings.

# select to_char(now(),'"YYYY-MM-DD HH24:MI:SS =" YYYY-MM-DD HH24:MI:SS');
to_char
---------------------------------------------
YYYY-MM-DD HH24:MI:SS = 2002-12-23 10:33:40

Karel

PS. sorry of my delay in this discussion, I was out of town.

--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message SZUCS Gábor 2002-12-23 10:39:50 Re: How to backup a postgreSQL of 80 GByte ?
Previous Message Billy G. Allie 2002-12-23 06:05:25 Re: PerformPortalClose warning in 7.3