Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: rounding to 15 seconds

Re: rounding to 15 seconds

From: Jake <me_at_heyjay.com>
Date: Mon, 22 Sep 2003 21:52:53 -0500
Message-ID: <bkockg$ed7$2@bob.news.rcn.net>


Thanks Patrick

Jake
"Patrick Connors" <pmc_at_finger-rock.com> wrote in message news:c0f4d322.0309221527.3c465454_at_posting.google.com...
> "Jake" <me_at_heyjay.com> wrote in message
news:<bkn3hr$i3h$1_at_bob.news.rcn.net>...
> > Hi,
> >
> > I have a process that retrieves a stock quote, roughly, every 15
seconds.
> > I'd like to round the date to every 15 seconds, so that the dates end on
0,
> > 15, 30, 45 seconds.
> >
>
> Try this (note: I've used sysdate as the date):
> This rounds down.
>
> select
> to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') as "sysdate",
> to_char(sysdate,'YYYY/MM/DD HH24:MI:') ||
> to_char(trunc(to_number(to_char(sysdate,'SS'))/15)*15) as rounded
> from dual
> /
>
> Results returned (edited slightly):
> SYSDATE ROUNDED
> ------------------- ---------------------
> 2003/09/22 16:25:44 2003/09/22 16:25:30
> 2003/09/22 16:25:46 2003/09/22 16:25:45
> 2003/09/22 16:26:27 2003/09/22 16:26:15
Received on Mon Sep 22 2003 - 21:52:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US