home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / database / oracle / 2497 < prev    next >
Encoding:
Text File  |  1992-12-13  |  1.4 KB  |  39 lines

  1. Newsgroups: comp.databases.oracle
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!wupost!csus.edu!netcom.com!tssmith
  3. From: tssmith@netcom.com (Tim Smith)
  4. Subject: Re: Julian to normal date.
  5. Message-ID: <1992Dec13.074253.12856@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. References: <1gav7fINNfpk@flop.ENGR.ORST.EDU>
  8. Date: Sun, 13 Dec 1992 07:42:53 GMT
  9. Lines: 28
  10.  
  11. In article <1gav7fINNfpk@flop.ENGR.ORST.EDU> dewaler@prism.CS.ORST.EDU (Eric DeWald) writes:
  12. >I am doing date conversions.
  13. >I would like to know what is the best way to convert
  14. >a Julian Date into a normal date.
  15.  
  16. Within ORACLE, it's easy.  For example, to *get* a Julian date, you
  17. could do as the SQL Lang. Ref. Manual suggests, and say
  18.  
  19. SELECT TO_CHAR(TO_DATE('01-JAN-92', 'DD-MON-YY'), 'J') FROM dual
  20.  
  21. to get a Julian date of 2448623.
  22.  
  23. To convert that figure back into a "normal" date, simply do
  24.  
  25. SELECT TO_DATE(2448623, 'J') FROM dual
  26.  
  27. and you get a character string: 01-JAN-92.
  28.  
  29. There is one caveat though.  ORACLE's Julian dates might not be like
  30. other Julian dates.  They'll work within ORACLE consistently, but they
  31. might give errors if you use other commercial subroutines that convert
  32. between Julian dates and our conventional BCE/CE (BC/AD) dates.
  33.  
  34. The reasons for this are esoteric.  The Julian epoch (starting point)
  35. is usually set at January 1, 4713 BCE.  ORACLE sets it as Jan 1, 4712
  36. BCE, as if there were a year 0 BCE (there isn't).
  37.  
  38. --Tim (tssmith@netcom.com)
  39.