pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Forø Tollefsen <andreasft@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Create Datefield from 3 fields
Date: Wed, 6 Oct 2010 13:11:04 +0200
Message-ID: <AANLkTimswkQCUiZMT4EGkE-w5XKv5mgd3RcfdnT-N8QF@mail.gmail.com> (raw)

Hi.

I am trying to create a datefield using YEAR, MONTH and DAY fields of type
integer.
I tried this query, but it did not give good results:
select to_date(gwsyear::text || gwsmonth::text || gwsday::text,
'YYYY-MM-DD') FROM cshapes
"1966526-01-01"
"7991903-12-13"
"1962831-01-01"
"194611-01-01"
"196211-01-01"

Any ideas on how to do this?

view thread (3+ messages)  latest in thread

Message-ID: <AANLkTimswkQCUiZMT4EGkE-w5XKv5mgd3RcfdnT-N8QF@mail.gmail.com>
Permalink:  ../AANLkTimswkQCUiZMT4EGkE-w5XKv5mgd3RcfdnT-N8QF@mail.gmail.com/
Also on:    postgresql.org/message-id/AANLkTimswkQCUiZMT4EGkE-w5XKv5mgd3RcfdnT-N8QF@mail.gmail.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: andreasft@gmail.com
  Subject: Re: Create Datefield from 3 fields
  In-Reply-To: <AANLkTimswkQCUiZMT4EGkE-w5XKv5mgd3RcfdnT-N8QF@mail.gmail.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