Skip to content

Instantly share code, notes, and snippets.

@JohnLBevan
Created January 25, 2014 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JohnLBevan/7d28c918c54f0fa04773 to your computer and use it in GitHub Desktop.
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
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