Focal Point
Way to convert Julian date to a normal date MM/DD/YY ??

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5701055782

June 11, 2008, 05:21 PM
Rob M.
Way to convert Julian date to a normal date MM/DD/YY ??
I looked through the various functions in Webfocus and can't seem to find one that will convert my Julian Dates to standard MM/DD/YY date format.

Is there a way?


Rob M.
Target Corporation

WF 7.1.4
June 11, 2008, 05:40 PM
Sayed
http://techsupport.informationbuilders.com/sps/71161021.html

Sayed


WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE
June 11, 2008, 08:22 PM
Tom Flynn
Here is a more current example:

 
SET DEFCENT=19
SET YRTHRESH=50

TABLE FILE EMPLOYEE
PRINT HIRE_DATE
COMPUTE JULIAN/I5 = JULDAT(HIRE_DATE, JULIAN); 
COMPUTE GREG_DATE/I8 = GREGDT(JULIAN, 'I8');
COMPUTE DATE_GREG1/I8YYMD = GREG_DATE;
COMPUTE DATE1_CONV1/MDYY = DATE_GREG1;
COMPUTE TOM_JUL/I5 WITH LAST_NAME = 08163;
COMPUTE TOM_GREG/I8 WITH LAST_NAME= GREGDT(TOM_JUL,'I8');
COMPUTE DATE_GREG2/I8YYMD = TOM_GREG;
COMPUTE DATE_CONV2/MDYY = DATE_GREG2;
BY LAST_NAME BY FIRST_NAME
WHERE DEPARTMENT EQ 'PRODUCTION';
END
-EXIT
 


Hope this helps...

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
June 12, 2008, 10:15 AM
Rob M.
Hi Tom,

Unfortunately it did not work. See below for results....

GLDGJ is the original julian date in the master file 1.
GLDATE2 is a defined field in my master file 1 DEFINE GLDATE2/I8 = GREGDT ( GLDGJ , GLDATE2 )

Then the rest of the columns are a result of the computes from your example above. What's wrong?

GLDGJ
108157

GLDATE2
1080605

JULIAN
0

GREG_DATE
0

DATE_GREG1
1900/12/31

DATE1_CONV1
field was blank


Rob M.
Target Corporation

WF 7.1.4
June 12, 2008, 10:24 AM
Tom Flynn
Rob,

It looks you have a 1 in the 1st byte to identify a century: Correct??

If so,

DEFINE GLDGJ_X/I5 = EDIT(EDIT(GLDGJ,'$99999'));

The rest should process fine...

OR DECODE the 1st byte to it's definition.

Julian dates are ususally 5 (08164) or 7 (2008164) bytes...

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
June 12, 2008, 12:35 PM
Edward Wolfgram
Try this for a fast (not using subroutine) way to convert your julian dates:


DEFINE FILE CAR                         
MYJUL/I8 WITH COUNTRY = 108157 ;        
MYYR/I4 = MYJUL/1000 ;                  
MYDAY/I3 = MYJUL - (MYYR*1000) ;        
MYI8/I8YYMD = (MYYR+1900)*10000 + 0101 ;
MYDAT/MDYY = MYI8 ;                     
MYDAT      = MYDAT + MYDAY - 1;         
END                                     
TABLE FILE CAR                          
PRINT MYJUL MYYR MYDAY MYI8 MYDAT       
END                                      



IBI Development