How do i convert a portion of day into a time?
How do i convert a portion of day into a time, without dividing and modding the number myself?
For example, i calculated solar noon UTC to be .733409047. Adding that to the date gives the correct answer:
SQL> SELECT TO_DATE('1/1/2012', 'DD/MM/YYYY') + .733409047 FROM Dual;
TO_DATE('1/1/2012',
-------------------
01/01/2012 17:36:07
A few questions, to actually understand this.
Is .733409047 implicitly converted? If so, to what datatype?
If i want HH:MM:SS does it need to be converted to a date, and then TO_CHAR? Or can the decimal be directly converted?
I'm currently trying to understand INTERVAL.
SQL> select interval '.5' day from dual;
select interval '.5' day from dual
*
ERROR at line 1:
ORA-01867: the interval is invalid
So, i'm obviously misunderstanding it. Can it be used here?