Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: rounding to 15 seconds
Thanks Mihai
Jake
"Mihai Pora" <mihai.pora_at_hp.com> wrote in message
news:TiFbb.5344$IR6.2871_at_news.cpqcorp.net...
> Hello
> I used ceil() in this exprestion , but you may also use floor() or
> round().
> select to_char(
> to_date('20010101', 'YYYYMMDD')
> +
> ceil((24 * 60 * 60) * (sysdate - to_date('20010101', 'YYYYMMDD') ) /
15)
> * 15 / (24 * 60 * 60)
> , 'YYYY/MM/DD hh24:mi:ss')
> ,to_char(sysdate, 'YYYY/MM/DD hh24:mi:ss')
> from sys.dual;
>
> The basic idea is to aply the rounding function to the difference
between
> two dates.
> I took 20010101, but it may be any date as well.
>
>
> select to_char(
> to_date('2003/09/22', 'YYYY/MM/DD')
> +
> ceil((24 * 60 * 60) * (quotedate - to_date('2003/09/22',
'YYYY/MM/DD') )
>
>