JDE Jul date to ISO Format

Hi Experts,

Im digging in some java code and I found the following part in the Select part of a SQL definition see attached code,  just to get a jul-date from JDE into a ISO date format (YYYYMMDD).
and this is used for each of the date fields in the SQL def.

Is there no other solution then this garbage?
something maintainable?
a standard function?
a own written function?
an Include file? whatever

my java knowledege is verry low so please help me with an example.

Thanks


case when (a.JDAT IS NULL " +                                
or a.JDAT < 1011) then '0' ELSE " +                          
(to_char(to_date(to_char((1900 +  " +                          
(100 * TO_Number(substr(to_char(a.JDAT),1,1)))) " +          
+ substr(to_char(a.JDAT),2,2)) || '-01-01', 'yyyy-mm-dd') " +
+ (substr(a.JDAT,4,3) - 1), 'yyyymmdd')) END JDAT, " +

Open in new window

LVL 17
MurpheyApplication ConsultantAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
You'll have to forgive me - i don't know what 'JDE' is, nor 'Jul'. What datatype are you starting with?
0
MurpheyApplication ConsultantAuthor Commented:
Hi CEHJ

JDE = JD Edwards a (Software package) MRP, sales etc.

Jul = Julian date format = year/daynumber
normally it's yyddd, but JDE thinks to be clever and uses cyyddd, so standard Jul2date routines don't work
here

regards,
0
CEHJCommented:
OK

>>What datatype are you starting with?
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

MurpheyApplication ConsultantAuthor Commented:
Data type is uhhh Character
0
CEHJCommented:
Try the following. You can get 'fromJulian' here:

http://www.rgagnon.com/javadetails/java-0506.html
	int jul = 2436660; (Julian date)
	int[] atoms = fromJulian(jul);
	Calendar cal = new GregorianCalendar(atoms[0], --atoms[1], atoms[2]);
	String iso = new java.sql.Date(cal.getTimeInMillis()).toString();
	System.out.println(iso);

Open in new window

0
MurpheyApplication ConsultantAuthor Commented:
Found the answer :-S

TO_CHAR(TO_DATE(TO_CHAR(a.JDAT+1900000), 'YYYYDDD'), 'YYMMDD')
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MurpheyApplication ConsultantAuthor Commented:
Hi CEHJ,

I can't include your solution in a SQL string... and... its using the standard Julian date, not the stupid JDE one.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.