× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Vern wrote:
I don't know if anyone gave you this idea - first, timestamp_format
will work fine with this - i'm using a constant, but for the Julian date -
timestamp_format('2021025', 'YYYYDDD')

gives you '2021-01-25-00.00.00.000000' for the timestamp value.
At least, it did this correctly on our 7.3 box.

If you need the date only, wrap timestamp_format() with date().
Now your JDE value is CMMDDD, right?
How about adding 1900000 to that and using the digits function?
timestamp_format(digits(CMMDDD + 1900000), 'YYYYDDD')?

As I type that, I think I saw something like this in another post.
Apologies if it has already been suggested.

Vern -

This query:

SELECT
date(to_date(digits(1900000+gldgj),'YYYYDDD')) as date1
FROM f0911
WHERE gldgj > 0

Fails with:

Message ID . . . . . . : QRY2293 Severity . . . . . . . : 30
Message type . . . . . : Information

Message . . . . : Query cannot be run. See lower level messages.
Cause . . . . . : An error occurred when the query to be run was opened or
while output was being created. Either a cancel reply was received to an
inquiry message about the problem, or the request was ended abruptly without
use of an inquiry message. In most cases the problem involves data that is
not correct or data that is not being used correctly.

Perhaps this explains the failure:

DIGITS(1900000+gldgj) produces a computed value which has a 12-byte length.
CHAR(), as suggested by Rob, strips the leading zeros.

Also, if gldgj = zeros, it also fails, thus I added WHERE GLDGJ > 0

Casting the computed value within the DIGITS() function as length 7 works (see Date3 below):

SELECT
gldgj
, digits(1900000 + gldgj)
, char(1900000 + gldgj)
, date(to_date(char(1900000 + gldgj),'YYYYDDD')) as date1
, date(to_date(right(digits(1900000 + gldgj),7),'YYYYDDD')) as date2
, date(to_date(digits(cast(1900000 + gldgj as numeric(7,0))),'YYYYDDD')) as date3
From F0911
WHERE GLDGJ > 0

G/L DIGITS CHAR DATE1 DATE2 DATE3
Date
--------
98,365 000001998365 1998365 1998-12-31 1998-12-31 1998-12-31
98,365 000001998365 1998365 1998-12-31 1998-12-31 1998-12-31
98,365 000001998365 1998365 1998-12-31 1998-12-31 1998-12-31
98,365 000001998365 1998365 1998-12-31 1998-12-31 1998-12-31
98,365 000001998365 1998365 1998-12-31 1998-12-31 1998-12-31
98,365 000001998365 1998365 1998-12-31 1998-12-31 1998-12-31
98,365 000001998365 1998365 1998-12-31 1998-12-31 1998-12-31
98,365 000001998365 1998365 1998-12-31 1998-12-31 1998-12-31
98,365 000001998365 1998365 1998-12-31 1998-12-31 1998-12-31
98,365 000001998365 1998365 1998-12-31 1998-12-31 1998-12-31
******** End of data ********

Regards,
Steve Landess
(512) 289-0387

________________________________
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Vern Hamberg <vhamberg@xxxxxxxxxxxxxxx>
Sent: Thursday, November 11, 2021 11:54 AM
To: midrange-l@xxxxxxxxxxxxxxxxxx <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: TIMESTAMP_FORMAT

YYYYMMAA or DDMMYYYY to Julian YYYYDDDD) for that I recommend invoking
(Call) the program X0028, which has the function of convert from Gregorian Date
to Julian and vice versa, once the date has been converted you will have the parameters
with the date in the appropriate format (YYYYDDDD) to be used in any embedded SQL
or as you should use it Best Regards
Sergio -

Thanks for your comments.

I have been working with JDE for almost 40 years, so I am very familiar with all of the JDE callable routines for validating and manipulating data. In this case, my interest is in SQL scripts or SQL queries against the JDE files, and I need the simplest way to query JDE and compare jde date fields OUTSIDE of the JDE software.

Alan's iDate UDF is perfect for that!

Regards,
Steve Landess
512-289-0387

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fmidrange-l&amp;data=04%7C01%7C%7C87c85e4f070b41da481608d9a53c53f9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637722500787557430%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=boqyZPeUTjS85HRJkH7QtEoYzrLNqF%2B3tMMD4fgVoiE%3D&amp;reserved=0
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fmidrange-l&amp;data=04%7C01%7C%7C87c85e4f070b41da481608d9a53c53f9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637722500787557430%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=bgITi9scSRlTmIyiSPOBlPzaTxks6jth7YqV1kP7dmA%3D&amp;reserved=0.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Famazon.midrange.com%2F&amp;data=04%7C01%7C%7C87c85e4f070b41da481608d9a53c53f9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637722500787557430%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=p1O%2FJanZdoThDX9R%2B2C82jr%2BZRSxFU7%2Fr06DpayL874%3D&amp;reserved=0

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.