string to date conversion

From: Jerome Alet <alet(at)librelogiciel(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: string to date conversion
Date: 2005-04-22 08:43:01
Message-ID: 20050422084301.GB12176@mail.librelogiciel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

I'm working on an existing Pg database which, please don't ask why,
stores dates as varchar attributes in the form 'YYYY/MM/DD'

I'm not allowed to modify the tables to use 'timestamp' instead,
so I'd like to convert on the fly when retrieving datas with
select.

When I do :

select mydatefield::timestamp from mytable;

There's an error saying that converting from varchar to date is
not possible

How can I do this ?

Thanks in advance

Jerome Alet

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ramakrishnan Muralidharan 2005-04-22 09:08:43 Re: string to date conversion
Previous Message Christoph Haller 2005-04-22 08:42:17 Re: RULE for mtime recording