• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

JDEDATE

ProjectRoom

Well Known Member
Hows does the JDEDATE work, im not interested in the JDE functions,
i mearly want to manually convert

20/06/01 into JDEDATE format.

Whats teh specifications on this conversion?


example:

19/06/01 is 101171 in JDEDATE format

can u explain how to manually convert this without referenceing JDE functions, a normal c++ function is acceptable :)

cheers

Project Room

B7.3.3.2
11.3
NT 4
 

tom_brown

Active Member
take 101171 for example...

characters 1-3 are the year since 1900, ie 2001.

characters 3-6 are the day of the year, ie 1st Jan = 001, 31st Jan = 031 etc

so you can work it out manually with loads of if statements

if last 3 chars are 0-31 then jan
if last 3 chars are 32-60 then feb

etc...

Hope this is what you wanted

Tom Brown
 

Carl_Fisher

Well Known Member
Jde date is made up as follow:

CYYDDD

C = Century indicator - 0 for 19, 1 for 20 etc.
yy = Year - ie 01, 99 etc
DDD = Day number in year (from 1 to 365 (or 366) counting from 01 Jan = 1





OW733.3 Xe SP 14.2
Enterprise Server - Intel NT + Oracle 8.0.6
Client - Citrix TSE + Some 95 and NT PC's
 
JDE stores date format in Julien. It is calculated like this:-
1 - Century
01 - Year
31+28+31+30+31+19 = 170
J F M A M J

So the date will be stored as 101170

regards

Arup Choudhury
Sr. Manager - Business Applications
Lafarge India Limited
Calcutta
India




ProjectRoom
<ProjectRoom@mailb To: jdeowdevml@jdelist.com
omb.net> cc:
Sent by: Subject: JDEDATE
owner-jdeowdevml@j
delist.com


21/06/2001 05:02
PM
Please respond to
jdeowdev





Hows does the JDEDATE work, im not interested in the JDE functions,
i mearly want to manually convert

20/06/01 into JDEDATE format.

Whats teh specifications on this conversion?


example:

19/06/01 is 101171 in JDEDATE format

can u explain how to manually convert this without referenceing JDE
functions, a normal c++ function is acceptable :)

cheers

Project Room

B7.3.3.2
11.3
NT 4


--------------------------
Visit the forum to view this thread at:
http://198.144.193.139/cgi-bin/wwwthreads/showflat.pl?Cat
=&Board=OWDEV&Number=13749
 

tpw_nz

Active Member
Are you interested in database JDEDATEs or business function JDEDATEs?

Others have talked about database dates. However bf dates are different again.

If you are interested in C functions not db stuff then....

The JDEDATE structure is.

struct tagJDEDATE {
short nYear;
short nMonth;
short nDay;
};

If you have a JDEDATE variable called jdDate you can reference jdDate.nYear, jdDate.nMonth or jdDate.nDay as you like. If you want to do a quick and dirty conversion (not recommended) you could use.

jdDate.nYear = 2001;
jdDate.nMonth = 6;
jdDate.nDay = 20;

Alternatively, using an API.

where szDate = "20/06/01"
rc = DeformatDate(&jdDate, szDate, "ASOSR");


Hope this helps.





B7332 SP15.1. NT/AIX. Oracle 8.1.6
 

DBohner-(db)

Legendary Poster
Project,

I guess the other guys didn't really understand your question? You wanted
to know how to convert YYMMDD to CCCDDD(JDE Format)?

I am quite handy with Access - This is an example of how you can convert the
dates in access. You can use similar logic inside VB, VBA, C, C++ and,
probably, CLP.

Recently I had to import a CSV Text file, with dates, into a JDE Z file.
The example is a little long, but I'll try to keep it clean.

Inside the text file there were dated in the following format - CCYYMMDD
(Your dates are similar).

* I imported the CSV's dates(DOB) as text - into an Access table.
* I added to new fields to the access table. One as an Access Date and the
other as numeric/integer.
* Using an update query, update the new date field with the following
formula: Mid([DOB],5,2) & "/" & Mid([DOB],7,2) & "/" & Mid([DOB],3,2).
This formula will dissect and concatenate the text field, DOB, from CCYYMMDD
to Access date format MM/DD/YY. For this example, I am updating the new
field DOBDATEFORMAT.
* Using a new update query, update the new Numeric field with the following
formula: Year([DOBDATEFORMAT])-1900 &
Format([DOBDATEFORMAT]-DateSerial(Year([DOBDATEFORMAT])-1,12,31),"000").
DOBDATEFORMAT is the converted text date. The numeric field will be updated
with a numeric equal to a JDE Julian Date.

You can then load the numeric/integer into a JDE table...

I know, it's a pain!

JDE - XE & AS/400

Daniel
drbohner@existinglight.net
www.existinglight.net

or my day job...

Daniel Bohner
Simplot Corporate Information Systems
Pioneer Building
Boise, ID 83702
(208)250-1917 personal cell
dbohner@simplot.com



Daniel Bohner
drbohner@existinglight.net
www.existinglight.net
JDE - XE & AS/400
JDE - B7331 & MS SQL 7x
 

Christian Audet

Moderator
Staff member
Hi Project Room,

If you ONLY want to convert a date like 20/06/01. You don't event need to know the julian way. That's true, in C you only need to assign to the JDEDATE structure member the three parameters (day, month,year)

Let say that you have this function.

Convert Date to JDE Date
DateString (input)
JDEDate (output)

then your part of your code will look like that in C
==============================
strncpy(szTmpDay,lpDS->DateString,2);
szTmpDay[2] = '\0';
strncpy(szTmpMonth,&lpDS->DateString[3],2);
szTmpMonth[2] = '\0';
strncpy(szTmpYear,&lpDS->DateString[6],2);
szTmpYear[2] = '\0';


JDEDate.nDay = (int) tmpDay;
JDEDate.nMonth = (int) tmpMonth;
JDEDate.nYear = (int) tmpYear;

** (you will have to manage the +1900 or +2000 for year if your date only have 2 digit)

==============================
The JDEDate variable will automatically return to the calling program a true JDEDate.

Christian Audet

Implementing B7333 (Xe) SP14.1, SQL
(Support B732, B7331 and B7332)
 
In C, create two arrays to store the number of days in each month, one for leap year and one for non-leap year.

leap = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
nonleap = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}

Subtract 1900 from your 4-digit year. This will give you the first 2 or 3 digits of your JDEDATE. If the date you are converting is 6/20/2001, you'll get 2001 - 1900 = 101.

To get the next three digits (number of days since the start of the year), find out if its a leap year by dividing the 4-digit year by 4. If the remainder is zero, its a leap year (exept for a century year, e.g. 1900, 2000, 2100).

Then simply add the number of days for all months prior to the month in question, and then add the given date to that sum. In your example, since 2001 is a non-leap year, you'll add the days in all months prior to June (January to May) from the non-leap array. This gives you 151. Then add the date (20) to this and you get 171. Your JDEDATE will be 101171.

Muneeb Ahmad
 

bioriz

Member
There is a very simple way to convert JDE juilian dates without using standard JDE functions. I use it all the time when creating Q&D reports via IBM Query. There is a file F00365 which has about 10 years worth of conversions in it. You link the julian date from the input file to ONDTEJ in F00365. This will give you the date in several more usable formats. It is extra IO, but if your not dealing with hundreds of thousansds of records, it works much easier than trying to convert via coding.
 

barrier

Reputable Poster
Or use business function B41B0470 (Format Date From Day Month Year) to
create the JDE julian date.

B.
 

Zoltan_Gyimesi

Legendary Poster
Hi,

1.) Bioriz, I wasn't able to locate the F00365 table neither in OL under B7331 nor in OMW under XE. Is it a custom table? If yes then how do you fill it with records? I suppose you have to write the conversions to fill it up but if you have written the conversions once then you can use it instead of the table (except if you fill it up with a non-OneWorld tool, then you can not use it in OW)? Did I missunderstand somthing?

2.) Nobody mentioned already (maybe because it is too trivial) that you can calculate the days for Julian format substructing the date of the first day of the year and add 1 to it if you have date arithmetic in your tool (or substract the date of the last day of the previous year).
For example:
nDaysForJulian = dDateToConvert - date(year(dDateToConvert),1,1) + 1
...OR...
nDaysForJulian = dDateToConvert - date(year(dDateToConvert)-1,12,31)
where
"date" is a function with arguments as date(year,month,day).

3.) At last a non OW specific note. The best date storage method that I have ever seen was to store simply the number of days before/after Christ as a signed integer. No Y2K problem, no date arithmetic problem, etc.

Regards,
Zoltán
P.S.: My internet connection to the Forum is terrible slow today.

B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 

bioriz

Member
Zoltan,

It must be a World table that wasn't brought over to OW. We are co-existent here. Its been around so long, I just thought they would've kept it. JDE had a program (P00365) that would fill a x-ref table with julian date and month/day/year in different formats. I guess something similar can be done for the person that wants to have something outside of JDE to convert the date by doing this simple table lookup. They can use standard JDE function to create the translation table. Unless of course they get enough hints on converting date format via code.
 

Christian Audet

Moderator
Staff member
Hi Project Room,

You got so many sugestion on this issue that a feedback would be apreciated. Are we answering your question right, do you still have the error?

Thank !

Christian Audet

Implementing B7333 (Xe) SP14.1, SQL
(Support B732, B7331 and B7332)
 

Adrian_Chimirel

Legendary Poster
Christian & Co,

I don't want to be rude; I'm just trying to get a feeling on how PrjRm deals with THOSE (TOO?) many replies; sorry but I would be really confused.

The first thing to be clarified is her/his question, where the JDEDATE and julianDate topics are (unfortunately) mixed together;

1a-JDEDATE is NOT a julian date!
1b-JDEDATE's structure was described on a prior reply - it deals with Year (in 2 OR 4 digits format), month & day, all mn( which stands for Math Numeric).
2-The (JDE)Julian date's structure was described as Century, Year & Day in Year (again, numbers)
3-PR needs to know the logic that makes a standard DATE format (and it has to be specified JR, something like mm/dd/yyyy ...) to get translated into a (JDE)Julian Date format OR viceversa), therefore, she/he should have had the language specified (C, VB, VBA)/DB(Access, Oracle, SQL Server)/ ... well, something, there, you know.
4-Finally the List should know how old PR is, what are his/her hobbies, pet name ... , and some feedback like "Thanks guys, I didn't get a clue of what you're saying, ..., OR that code was fine, ... :)

My last 2 CAD ¢,
Adrian

LIVE: B732.1 SP12.2, Oracle 806, FormScape 2.1
SANDBOX: Xe SP15 & Update1, Oracle 8i
RS/6000, Citrix
 
Top