Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Dates
('binary' encoding is not supported, stored as-is)
>Hi,
>
>how do i round dates like this:
>Date = 01-01-1996
>Return = 01-01-2000
>
>or
>
>Date = 01-01-1992
>Return = 01-01-1990
>
>
>Thanks.
>
create or replace function decade_round(p_date in date)
return date
is
d_result date;
begin
d_result := to_date('01/01'||ltrim(round(to_number(to_char(p_date,
'YYYY')),-1)), 'DD/MM/YYYY');return d_result;
Regards,
Stephane Faroult
Oriole
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Stephane Faroul INET: sfaroult_at_oriolecorp.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Fri Oct 18 2002 - 06:23:40 CDT