Re: issue with an assembled date field

From: "Martin Gainty" <mgainty(at)hotmail(dot)com>
To: "brian" <brian(at)zijn-digital(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: issue with an assembled date field
Date: 2008-02-29 19:18:06
Message-ID: BLU136-DAV147EF51FEEAF755C791A9DAE140@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Brian is right

change substring(ilch.lot_id::text, 5, 1) and
change '01/01/0'::text ||

to
'01/01/'::text || substring(ilch.lot_id::text,4,2)

M--

----- Original Message -----
From: "brian" <brian(at)zijn-digital(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Sent: Friday, February 29, 2008 1:11 PM
Subject: Re: [GENERAL] issue with an assembled date field

> Chris Bowlby wrote:
> > Hi All,
> >
> > I am currently running into an issue with a query and would like to get
> > some assistance if possible.
> >
> > The PostgreSQL version I am running is 8.0.11 64-Bit, under SuSE Linux
> > Enterprise Server 9 SP3
> >
> > I am converting an encoded field (lot_id) into a date field, the 5
> > character of every lot_id is always the year and as such I need to
> > extract the year using the following function:
> >
> > substring(ilch.lot_id::text, 5, 1)
> >
> > I am not worried about month or day as it is not used in what I need to
> > do, which is why I am using '01/01' for my main concatenation:
> >
> > '01/01/0'::text || ...
> >
>
> You're going to have another problem in about 22 months.
>
> b
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org/
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-02-29 19:33:58 Re: issue with an assembled date field
Previous Message Chris Bowlby 2008-02-29 19:07:11 Re: issue with an assembled date field