DATE help (adding 7 hours to a date) [message #210162] |
Tue, 19 December 2006 13:34  |
staann56
Messages: 136 Registered: May 2006 Location: atlanta
|
Senior Member |
|
|
I have a date in our database that is stored as a ten digits number (7557285500) and the datatype is number. I need to add seven hours
to this date and do calculations with it. I've tried the following:
(pr.perform_date+7/24) but the output is 7557285500.2916666. What am I doing wrong?
Thanks,
Stan
|
|
|
|
|
|
Re: DATE help (adding 7 hours to a date) [message #210178 is a reply to message #210162] |
Tue, 19 December 2006 15:56   |
srinivnp
Messages: 136 Registered: January 2006 Location: stlouis MO USA
|
Senior Member |
|
|
Number as date ! Yuck !!
Now tell us what would be your number for these two dates.
te2mgphm>select sysdate,sysdate+numtodsinterval(7,'HOUR') from dual;
SYSDATE SYSDATE+NUMTODSINTE
------------------- -------------------
2006-12-19 14:52:58 2006-12-19 21:52:58
Once we have those two "numbers" we can figure out a way.
Srini
|
|
|
|
|
|
|
Re: DATE help (adding 7 hours to a date) [message #210192 is a reply to message #210190] |
Tue, 19 December 2006 17:12   |
staann56
Messages: 136 Registered: May 2006 Location: atlanta
|
Senior Member |
|
|
What is you point ebrian!
I didn't use
'to_date' in my example (so that you wouldn't have to guess, remember!!!!). Try using the pieces of the puzzle provided!
I used:
ddt.tochar(pr.perform_date,'mm/dd/yyyy hh24:mi') and it returns
11/29/2006 23:45
so type this in:
select
ddt.tochar(7557285500,'mm/dd/yyyy hh24:mi')
from
dual
|
|
|
|
Re: DATE help (adding 7 hours to a date) [message #210196 is a reply to message #210194] |
Tue, 19 December 2006 17:23   |
staann56
Messages: 136 Registered: May 2006 Location: atlanta
|
Senior Member |
|
|
I'm not sure why it's not working for you.
select
ddt.tochar(7557285500,'mm/dd/yyyy hh24:mi')
from
dual
returns: 11/29/2006 23:45
and
select
ddt.tochar(7557285500+25200,'mm/dd/yyyy hh24:mi')
from
dual
returns: 11/30/2006 02:58 (2hrs and 13 mintues later, not the desired 7 hours later)
what else do you want?
|
|
|
|
|
|
|
|
|