Created
January 25, 2014 19:25
-
-
Save JohnLBevan/7d28c918c54f0fa04773 to your computer and use it in GitHub Desktop.
Oracle PL-SQL code to convert JDEdwards Julian Dates to dates / formatted strings From http://sqlfiddle.com/#!4/42244/1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select julianDateCol | |
, case | |
when nvl( julianDateCol ,0)=0 | |
then 'no date' | |
else to_char | |
( | |
to_date | |
( | |
1000 * | |
( | |
to_number | |
( | |
substr(lpad(to_char( julianDateCol ),6,'0'),1,3) | |
) | |
+1900 | |
) | |
+ to_number | |
( | |
substr(to_char( julianDateCol ),length(to_char( julianDateCol ))-2,3) | |
) | |
,'YYYYDDD' | |
) | |
,'DD-MON-YYYY' | |
) end FormattedDate | |
from SomeTable; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment