I know since we posted the JDE date to real date function, everyone has been wondering where the real date to JDE date function is.  Well, “ask and you shall receive.”

drop function myuser.DateToJ!

CREATE function myuser.DateToJ (RealDate date)
    returns decimal(8,0)
    language sql
    deterministic
    no external action
begin atomic
   if RealDate is null then
      return 0;
   else
      return ((Year(RealDate) - 1900) * 1000) + DayOfYear(RealDate);
   end if;
end!


select myuser.DateToJ(date('2008-11-18'))
from myuser.dual!