Re: Create Datefield from 3 fields

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Create Datefield from 3 fields
Date: 2010-10-06 11:36:16
Message-ID: i8hmvg$mqd$1@dough.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Forø Tollefsen 2010-10-06 11:43:32 Re: Create Datefield from 3 fields
Previous Message Andreas Forø Tollefsen 2010-10-06 11:11:04 Create Datefield from 3 fields