June 20, 2012 at 12:03 pm
Does anyone know of an easy method to convert a Julian Date from JD Edwards to Gregorian? I would like to do this in a reporting srvcs project. Thanks
June 20, 2012 at 12:05 pm
Don't know what a JD Edwards Julian Date is so I couldn't at the moment.
June 20, 2012 at 12:10 pm
What I mean is to convert a date from julian to gregorian. Example would be ; Julian - 112074 convert to 03/14/2012 thanks
June 20, 2012 at 12:18 pm
Try this:
DECLARE @jdejulian INT;
SET @jdejulian = 112031;
SELECT
DATEADD(dd, CAST(RIGHT(RIGHT('0' + CAST(@jdejulian AS VARCHAR), 6),3) AS INT) - 1, DATEADD(yy, CAST(LEFT(RIGHT('0' + CAST(@jdejulian AS VARCHAR), 6),3) AS INT), 0));
June 20, 2012 at 12:19 pm
Working on another way at this time as well.
June 20, 2012 at 12:22 pm
Here is a better way:
DECLARE @jdejulian INT;
SET @jdejulian = 112074;
SELECT DATEADD(dd, (@jdejulian % 1000) - 1, DATEADD(yy, @jdejulian / 1000, 0));
June 20, 2012 at 12:40 pm
And to convert a date >= 1900-01-01 to a JD Edwards Julian date:
DECLARE @ThisDate datetime;
SET @ThisDate = GETDATE();
SELECT (YEAR(@ThisDate) - 1900) * 1000 + DATEPART(dy, @ThisDate);
June 20, 2012 at 12:49 pm
Thank you for your replies. Do I add this in the custom code area?
June 20, 2012 at 12:52 pm
How you implement this in reporting services or JD Edwards code, I'm not sure. What I provided can be used in T_SQL queries.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply