Q: How to convert int to date? - Mailing list pgsql-general

From Mattias Kregert
Subject Q: How to convert int to date?
Date
Msg-id 358F8585.4C6C5362@algonet.se
Whole thread Raw
Responses Re: [GENERAL] Q: How to convert int to date?  (Marin D <marin@cybernet.bg>)
Re: [GENERAL] Q: How to convert int to date?  (Patrice Hédé <patrice@idf.net>)
Re: [GENERAL] Q: How to convert int to date?  (Patrice Hédé <patrice@idf.net>)
List 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 */

pgsql-general by date:

Previous
From: Naushit Sakarvadia
Date:
Subject: User authetication failed.
Next
From: Marin D
Date:
Subject: Re: [GENERAL] Q: How to convert int to date?