date conversion

nnswain

Active Member
Hi All,
I would like to retrieve the rows from f4211 where the so date is greate than today's date. i donot want to give the julian date for today.Is ther any standard function to convert today's date into julian?I want to do it thru strsql. current date /curdate is not working .
 
What are you retrieveing the ifo. thru or by? You could always write an RPG program using the udate reserve word. Convert it to the JDE Julian format, and run it that way. You might look at a web site called Tek-Tips, there are a lot of RPG programmers that will be glad to help you.
 
In DW and WW you can use the word *TODAY for the current date. If you are
using an AS/400 Query you can create some fields to convert the Julian value
to Gregorian and get the current date and then do a comparison. It all
depends on what you are running to get the data from.

Jim Rubino
Senior Programmer Analyst
FIKE CORPORATION (r)
704 South 10th Street
Blue Springs, Mo. 64015
(816) 229-6216 Ext. 213
WorldSoftware Technical Editor for JDEtips
 
By using three SQL functions you can turn a JD Edwards Julian date into a
more usable format. The following SQL statement will give you all of the
sales order records from F4211 that have a transaction date greater than
today's date:

SELECT * FROM F4211
WHERE DATE(DIGITS(DECIMAL(SDTRDJ + 1900000,7,0))) > CURRENT DATE

The DECIMAL(SDTRDJ + 1900000,7,0) will turn the internal date into a Julian
format of YYYYNNN. The DIGITS function turns the numeric value into a
character string. The DATE function will convert the character string into a
date data type. The "CURRENT DATE" value will substitute today's date. To
specify a date other than today use:

SELECT * FROM F4211
WHERE DATE(DIGITS(DECIMAL(SDTRDJ + 1900000,7,0))) > '11/13/03'

At my current client site I used the following to create a function called
JDDCONV in library QGPL:

CREATE FUNCTION QGPL/JDDCONV
(JDEDATE DECIMAL(6,0))
RETURNS DATE
LANGUAGE SQL
SET OPTION DATFMT=*ISO
BEGIN
DECLARE F_OUTPUT DATE ;
DECLARE F_TEST INTEGER ;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET F_TEST = 1 ;
SET F_TEST = 0;
SET F_OUTPUT = DATE(DIGITS(DECIMAL(JDEDATE+1900000,7,0)));
IF F_TEST = 0 THEN RETURN F_OUTPUT ;
ELSE RETURN NULL;
END IF;
END

I then can change my original SQL statement to:

SELECT * FROM F4211
WHERE JDDCONV(SDTRDJ) > CURRENT DATE

I hope this helps.

Mike Iaconis, President
Soar Technology Solutions
330-722-8106
[email protected]
 
Jim also posted this really useful tip last year....


I disagree with you on that query will not allow you to convert any date
........using the following you can convert a Julian date to a Gregorian
date.

TDATE date(substr(digits(sdtrdj+1900000
),2,7))

SDTRDJ if from the F42119 or F4211.........replace it with whatever date
field from the file you are using.

Jim
 
A pretty simple way in SQL is to use the date from the F00365 (ONDATE) to compare to today's date. Trick is to CAST(ONDATE as date) to change the field format from character to date. The SQL can compare to curdate().
 
It is worthwhile noting that there was a bit of chatter in this forum on date conversion and days between two dates in WW and Query during January - March 2001. Use the search function with "Date" AND "Calculation" to find most of the postings.
 
Hi all,
Thanx a lot.
I got the solution.
Select * from (table name) where date(field name)= date(current date)
 
Back
Top