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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Dates

RE: Dates

From: Stephane Faroult <sfaroult_at_oriolecorp.com>
Date: Fri, 18 Oct 2002 03:23:40 -0800
Message-ID: <F001.004ED1FA.20021018032340@fatcity.com>

 ('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;
end;
/

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

Original text of this message

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