From: | Eric Walstad <eric(at)walstads(dot)net> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: formatting a date when some nulls exist |
Date: | 2002-09-04 04:14:46 |
Message-ID: | 3D7588B6.9010906@walstads.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi Tom,
Here's the version:
ewtest=# select version();
version
-------------------------------------------------------------
PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96
(1 row)
...and...
[ewalstad(at)uluwatu ewalstad]$ uname -a
Linux uluwatu 2.4.18-10 #1 Wed Aug 7 11:39:21 EDT 2002 i686 unknown
Thanks for your time and assistance!
Eric.
Tom Lane wrote:
> Eric Walstad <eric(at)walstads(dot)net> writes:
>
>>I'm trying to format a date type column, which contains some nulls. I'm
>>getting an error:
>
>
>>ewtest=# select to_char(birthday, 'YYYY-MM-DD') from contacts;
>>ERROR: Unable to convert date to tm
>
>
> How old is your Postgres?? AFAIR that misbehavior has been gone since
> 6.5 or so. Certainly any recent version works:
>
> regression=# create table foo (f1 date);
> CREATE TABLE
> regression=# insert into foo values('today');
> INSERT 288761 1
> regression=# insert into foo values(null);
> INSERT 288762 1
> regression=# select to_char(f1, 'YYYY-MM-DD') from foo;
> to_char
> ------------
> 2002-09-02
>
> (2 rows)
>
> regression=#
>
> regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-09-04 04:42:15 | Re: formatting a date when some nulls exist |
Previous Message | Alvaro Herrera | 2002-09-04 03:29:42 | Re: [GENERAL] PostgreSQL papers |