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 Time

Re: Rounding Time

From: Michel Cadot <micadot_at_netcourrier.com>
Date: 2000/07/11
Message-ID: <8kfdkv$1pkg$1@s2.feed.news.oleane.net>#1/1

What's about using ROUND function?

v734> select sysdate, round(sysdate,'HH24') from dual;

SYSDATE ROUND(SYSDATE,'HH24

------------------- -------------------

11/07/2000 17:09:12 11/07/2000 17:00:00

1 row selected.

v734> select trunc(sysdate)+(23+31/60)/24,

      round(trunc(sysdate)+(23+31/60)/24,'HH24')
      from dual;

TRUNC(SYSDATE)+(23+ ROUND(TRUNC(SYSDATE

------------------- -------------------

11/07/2000 23:31:00 12/07/2000 00:00:00

1 row selected.

--
Have a nice day
Michel


<louster_at_my-deja.com> a écrit dans le message : 8kfapg$ka5$1_at_nnrp1.deja.com...

> I'm trying to round a time to the nearest hour on a 24 hr clock. I'm
> currently trying something like:
>
> TO_CHAR(L.LOGIN_DATE,'fmHH24')+(TRUNC(TO_CHAR
> (L.LOGIN_DATE,'fmMI')/30)) || ':00' as "Rounded"
>
> But the problem with this is 11:31pm rounds up to 24:00 but 1:29am
> rounds to 0:00. I can't have both 24:00 and 0:00. I'd like 11:31pm to
> round to 0:00. Any ideas?
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue Jul 11 2000 - 00:00:00 CDT

Original text of this message

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