Re: Create Datefield from 3 fields - Mailing list pgsql-sql

From Thomas Kellerer
Subject Re: Create Datefield from 3 fields
Date
Msg-id i8hmvg$mqd$1@dough.gmane.org
Whole thread Raw
In response to Create Datefield from 3 fields  (Andreas Forø Tollefsen <andreasft@gmail.com>)
Responses Re: Create Datefield from 3 fields  (Andreas Forø Tollefsen <andreasft@gmail.com>)
List pgsql-sql
Andreas Forø Tollefsen, 06.10.2010 13:11:
> 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

You are missing the dashes in the input string that you specify in the format mask
  to_date(gwsyear::text ||'-'|| gwsmonth::text ||'-'|| gwsday::text, 'YYYY-MM-DD')


Thomas



pgsql-sql by date:

Previous
From: Andreas Forø Tollefsen
Date:
Subject: Create Datefield from 3 fields
Next
From: Andreas Forø Tollefsen
Date:
Subject: Re: Create Datefield from 3 fields