Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting JDE Julian date to Gregorian date in SELECT statement

Status
Not open for further replies.

spamjim

Instructor
Mar 17, 2008
1,368
US
I have a MySQL table with Julian dates coming from JD Edwards data. JDE defines Julian dates as CYYDDD (century, year, day). July 4, 2018 is 118184.

Is there a way to select this data as a gregorian date in MySQL?

 
I think I've solved this as:

Code:
SELECT MAKEDATE(SUBSTRING(`jde_date_column`,2,2),substring(`jde_date_column`,-3)) AS `Date` FROM `table`

This query ignores the first century character and MySQL's MAKEDATE appears to assume '2018' from '18'. My data does not include anything prior to 2000 so I'm okay with the results, but any corrections are appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top