Keeping a jdDate in CYYDDD format

  • Thread starter Frosty the Coder
  • Start date

Frosty the Coder

Legendary Poster
List,

A user asked me to populate the DD items
DTBT and TCDE on F06116. These two DD's
represent TIME CLOCK START DATE & TIME and
TIME CLOCK END DATE & TIME.

Both DD's are numeric 13,0.

According to the KG they should be populated
as 0CYYDDDHHMMSS (zero, century, year, day,
hours, minutes, seconds).

At the time that I need to fill them, I
have a jdDATE (DWK - date worked) and
HHMM keyed into another control.

I've tried to concat(DWK,HHMM) but concat
changes the jdDATE into MMDDYY.

I've tried to substr(DWK,0,6) and still end
up w/MMDDYY.

I've tried to convert date to string (and
then convert the string to math_numeric)
to calc DTBT as ((DWK_math * 1000000) +
(HHMM * 100)) and _still_ it converts my
DWK into MMDDYY.

I've looked at various bsfns, all of which
seem to convert to MMDDYY.

How can I get my jdDATE into a math, or string,
and keep the format at CYYDDD?

Any/all help would be greatly appreciated.

Thanks

Gene

Gene Piekarski, Jr

AS/400, B733, SP11.2, NT client
AS/400, B733, SP14, W2000 client
XE, SP15.1
 
Use date_day() system function to retrieve the day of year. This will be your DDD. Use date_year() to retrive the 4-digit year. Subtract 1900 from it. This will be your CYY. Concatenate CYY with DDD.
 
Thank you for suggesting the date_year approach.

While date_days returns "31" for Mar 31,2002
I _was_ able to get what I needed by:

math01_YYYY = date_year(jdUPMJ_InputDate)

math01_YYYY = (1010000 + math01_YYYY)

convert numeric to string (math01_YYYY to aa10_YYYY)
getting 0101YYYY

string manipulate aa10_YYYY to get it equal to 01/01/YYYY

convert string to date (aa10_YYYY to jdUPMJ_Jan1st)

DDD = (days_between (jdUPMJ_Jan1st, jdUPMJ_InputDate) + 1)

CYY = YYYY - 1900

math01_InputDate = ((CYY * 1000) + DDD)

Again, thanks for your suggestion.

Gene

"The Long and Winding Road, ...."



Gene Piekarski, Jr

AS/400, B733, SP11.2, NT client
AS/400, B733, SP14, W2000 client
XE, SP15.1
 
I believe that the display of the date format is dependent upon one of
two things.

1. If you have an override set in your user options.
2. If no default is set in OW (#1), then it looks to the Windows
default settings for date, time, etc.

Therefore, no matter what you do, the date is going to display based on
one of these two settings, but by all means, please correct me if I am
wrong.
 
Re: RE: Keeping a jdDate in CYYDDD format

farkld2,

1 Gene was looking for a way to POPULATE F06116 (and he was specifying both fields are numeric).
2 You describe how the date is displayed (on a form) OR Printed (on a report) (and it is anything BUT numeric), when you specify or not a Date format in the User Options.

They are two DIFFERENT things, two different WAYS of dealing with JDE Date FORMATS ;)

1 When you manipulate dates within JDE, you have the option to use the Julian (kind of, but not precisely) format, in order to have more control on what is happening. However, what he described is what is happening when JDE takes control over the date format; luckily for us, there still are work-arounds to overcome unexpected results.

2 The date displays/prints based upon the User Option: SOME or NONE, and you were right, the default (none) uses the Windows System format.

Therefore, you CAN do things to populate OW tables the way OW was designed to deal with :)
You are not wrong; you were just referring a different issue.
Warm regards,
Adrian Chimirel
PS I am not sure the Tips & Tricks Forum has these things explained on a higher level of detail; I guess it would be helpful if it has.

Xe U3 SP17, Oracle 806, Citrix, HTML, FormScape 2.1 Ent RS/6000, AIX 4.2, Dep NT4
 
Back
Top