pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jerome Alet <alet@librelogiciel.com>
To: pgsql-sql@postgresql.org
Subject: string to date conversion
Date: Fri, 22 Apr 2005 10:43:01 +0200
Message-ID: <20050422084301.GB12176@mail.librelogiciel.com> (raw)

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



view thread (6+ messages)  latest in thread

Message-ID: <20050422084301.GB12176@mail.librelogiciel.com>
Permalink:  ../20050422084301.GB12176@mail.librelogiciel.com/
Also on:    postgresql.org/message-id/20050422084301.GB12176@mail.librelogiciel.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alet@librelogiciel.com
  Subject: Re: string to date conversion
  In-Reply-To: <20050422084301.GB12176@mail.librelogiciel.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox