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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Query: calculating the hour, on the hour

Re: Query: calculating the hour, on the hour

From: Paul J. McGlew <pmcglew_at_att.com>
Date: Tue, 12 Oct 1999 14:33:53 -0400
Message-ID: <38037F11.E2859B2A@att.com>


Select lpad(to_char(to_char(sysdate, 'HH24')-1),2,'0') hour from dual;

jwilkes66_at_my-deja.com wrote:

> I need a query that returns the previous hour, on the hour.
>
> Select to_char(to_char(sysdate, 'HH24')-1) from dual;
>
> This query returns '7', but I need a query that will always return 2
> characters ('07') and also will return '23' when it is midnight.
>
> Thanks for any help,
> JB
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue Oct 12 1999 - 13:33:53 CDT

Original text of this message

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