Julian date converter: [url]http://aa.usno.navy.mil/AA/data/docs/JulianDate.html[/url] You can view source to find the logic to convert Julian to a normal date. There might be an oracle function *shrug*
For the seconds one just divide by 60 to get minutes, divide by 60 to get hours, and subtract from when you pulled the date. In EST at least it would put startup at about Nov 16 12 noon (about 10:00 when you posted minus about 22 hours), which is what the julian date converter gets.
However that's not 22:20 that you mentioned. Did you pull that time from the alert log?
According to metalink, you need to run this for 7.3
select to_char(to_date(value, 'J'), 'DD-MM-YYYY HH24:MM:SS')
from v$instance,
where key = 'STARTUP TIME - JULIAN'
/
but this gave me the wrong value, so I tried linking the table to itself - since I guess you then need seconds past midnight:
select to_char(to_date(a.value, 'J') + to_date(b.value, 'SSSS'), 'DD-MM-YYYY HH24:MM:SS')
from v$instance a, v$instance b
where a.key = 'STARTUP TIME - JULIAN'
and b.key = 'STARTUP TIME - SECONDS'
but this said I can't add date + date (I'm not to good with date funtions!).
I haven't done my date functions homework either but I think I remember reading somewhere that you can't add dates (as you found out the hard way), that you want to add the character value to the date. Maybe if you to_char the seconds value, and add it to the to_date julian value? or vice versa?
I suppose this is why they ditched that notation and just used startup_time :)
select to_char(to_date('2451865', 'J')) from dual gives us Nov 16th.
We can get 22.37 hours from the 80538/60/60. What we need is to to_char the julian date to get Nov16th at 12:00am, then add 22.37 to it. I'm trying but when it adds 22 it's adding days instead of minutes. Let me play a little longer.
Edit:
Run this
select to_char(to_date('2451865', 'J') + 80538/60/60/24, 'DD-MM-YYYY HH24:MI:SS') from dual
Just change my hard coded numbers to your startup time value's and it should work.
Bookmarks