Q: How to convert int to date?

From: Mattias Kregert <matti(at)algonet(dot)se>
To: pgsql-general(at)postgresql(dot)org
Subject: Q: How to convert int to date?
Date: 1998-06-23 10:37:57
Message-ID: 358F8585.4C6C5362@algonet.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How do I convert INTEGER to DATE in 6.3.2?

I have a table 'mytbl' with a column 'd' which is
an integer, containing dates in YYMMDD form. Now,
how do I convert these integer dates to date dates?

I tried...
ALTER TABLE mytbl ADD COLUMN dd date;
UPDATE mytbl SET dd=date(d+1900);
...but there is no int-to-date function!

UPDATE mytbl SET dd=((d+1900)::unknown)::date;
...does not work either. No int-to-unknown function!

So, how do I cast to type unknown?

I have ... let's see... around 500-600 days
to solve this problem ;)

/* m */

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marin D 1998-06-23 11:03:16 Re: [GENERAL] Q: How to convert int to date?
Previous Message Brian 1998-06-23 01:45:24 datatype questions