pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: wireless200@yahoo.com
To: pgsql-sql@postgresql.org
Subject: how to get decimal to date form
Date: 17 Sep 2003 05:50:31 -0700
Message-ID: <90446ee7.0309170450.2f16d9ef@posting.google.com> (raw)

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



view thread (3+ messages)  latest in thread

Message-ID: <90446ee7.0309170450.2f16d9ef@posting.google.com>
Permalink:  ../90446ee7.0309170450.2f16d9ef@posting.google.com/
Also on:    postgresql.org/message-id/90446ee7.0309170450.2f16d9ef@posting.google.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: wireless200@yahoo.com
  Subject: Re: how to get decimal to date form
  In-Reply-To: <90446ee7.0309170450.2f16d9ef@posting.google.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox