Re: how to trunc date column to half an hour

  • From: Greg Rahn <greg@xxxxxxxxxxxxxxxxxx>
  • To: deryaoktay@xxxxxxxxx
  • Date: Tue, 06 Mar 2007 10:59:07 -0800

You didn't give the algorithm but something like this may work:

select to_char(sysdate,'yyyy-mm-dd hh24:mi'), case when to_number(to_char(sysdate,'mi')) between 0 and 29 then to_char(sysdate,'yyyy-mm-dd hh24')||':00' else to_char(sysdate,'yyyy-mm-dd hh24')||':30' end from dual;

This "rounds back", if you want to round you may have to adjust it to increase the hour as well.


Greg Rahn

-------- Original Message --------
Subject: how to trunc date column to half an hour
From: "Derya Oktay" <deryaoktay@xxxxxxxxx>
To: oracle-l <oracle-l@xxxxxxxxxxxxx>
Date: 3/6/2007 10:16 AM
Hi All,
Is there a way of displaying date columns, truncated to half an hours.

For example: select trunc(sysdate,'HH') from dual;


FYI. We are usig this sort of functions in group by expressions.

PS. Ghassan thank you for your answer regarding local/global index es in partitions.


Other related posts: