how to get decimal to date form

From: wireless200(at)yahoo(dot)com (wireless)
To: pgsql-sql(at)postgresql(dot)org
Subject: how to get decimal to date form
Date: 2003-09-17 12:50:31
Message-ID: 90446ee7.0309170450.2f16d9ef@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

In our postgre database is a decimal field with format YYMMDDhhmmss.9999999999
where the 9s are random digits. I'm trying to strip off just the
YYMMDD and put it in date form.

So far I came up with:
SUBSTR(TO_CHAR(rec_num,99999999999),1,6) AS Date which returns YMMDD.

For example where the rec_num is 30608124143.47069519725 the above
functions return 30608.

I tried wrapping another TO_CHAR around it to try to format it to a
date but this seems like it's a bit much for this purpose.

Any suggestions would be appreciated.

-David

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2003-09-17 13:50:30 Re: Sort order with spaces?
Previous Message Kristian Jörg 2003-09-17 12:39:28 Re: Sort order with spaces?