Re: Julian to normal date.

From: Tim Smith <tssmith_at_netcom.com>
Date: Sun, 13 Dec 1992 07:42:53 GMT
Message-ID: <1992Dec13.074253.12856_at_netcom.com>


In article <1gav7fINNfpk_at_flop.ENGR.ORST.EDU> dewaler_at_prism.CS.ORST.EDU (Eric DeWald) writes:
>I am doing date conversions.
>I would like to know what is the best way to convert
>a Julian Date into a normal date.

Within ORACLE, it's easy. For example, to *get* a Julian date, you could do as the SQL Lang. Ref. Manual suggests, and say

SELECT TO_CHAR(TO_DATE('01-JAN-92', 'DD-MON-YY'), 'J') FROM dual

to get a Julian date of 2448623.

To convert that figure back into a "normal" date, simply do

SELECT TO_DATE(2448623, 'J') FROM dual

and you get a character string: 01-JAN-92.

There is one caveat though. ORACLE's Julian dates might not be like other Julian dates. They'll work within ORACLE consistently, but they might give errors if you use other commercial subroutines that convert between Julian dates and our conventional BCE/CE (BC/AD) dates.

The reasons for this are esoteric. The Julian epoch (starting point) is usually set at January 1, 4713 BCE. ORACLE sets it as Jan 1, 4712 BCE, as if there were a year 0 BCE (there isn't).

--Tim (tssmith_at_netcom.com) Received on Sun Dec 13 1992 - 08:42:53 CET

Original text of this message