Add the hour field converted to a number divided by 24 plus the minute field
converted to a number divided by (24*60)

For example:

declare
num_hours varchar2(10) := '24';
num_mins  varchar2(10) := '10';
date_field date := sysdate;
new_date_field date := null;
begin
new_date_field := date_field +
(to_number(num_hours)/24+to_number(num_mins)/(60*24));
dbms_output.enable(20000);
dbms_output.put_line(num_hours);
dbms_output.put_line(num_mins);
dbms_output.put_line(to_char(date_field,'YYYY-MM-DD-HH24.MI.SS'));
dbms_output.put_line(to_char(new_date_field,'YYYY-MM-DD-HH24.MI.SS'));
end;
/


-----Original Message-----
Sent: Tuesday, July 31, 2001 11:31 AM
To: Multiple recipients of list ORACLE-L


I have 2 varchar2 variables, one  containing a number of hours and the other
containing a number of minutes, which I want to add to a date variable.

How can I do this?

John





-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: John Dunn
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (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).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Kevin Lange
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (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).

Reply via email to