Focal Point
Calculation between 2 dates

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

January 07, 2009, 02:49 PM
IMblessed
Calculation between 2 dates
I have 2 dates that I need to determine the number of days between them. One date is an A25V and the other is A10. The A25V field is displayed as 2008/01/11 so is the A10 field.


EDA764 Release * Current Software:
Unix
January 07, 2009, 03:01 PM
GinnyJakes
Extract the date portion without the slashes into another field (can use EDIT) then use EDIT to convert to I8YYMD. Then equate the I field to a smartdate field, format YYMD. Then just subtract the two.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
January 07, 2009, 03:08 PM
KenFR
  
date1 = A25V = '2008/01/11 '
date2 = A10 = '2008/01/11'

date1a/I8YYMD = EDIT(date1,'9999$99$99');
date1b/YYMD = date1a;

date2a/I8YYMD = EDIT(date2,'9999$99$99');
date2b/YYMD = date2a

difference/I6 = date1b - date2b;
  



8105 Tomcat and AIX reporting server
input: Teradata, SQL, DB2, Essbase, Oracle, text
output:html, excel, PDF,
January 07, 2009, 03:53 PM
IMblessed
I'm sorry the fields are 11/28/2008 instead of 2008/11/28.


EDA764 Release * Current Software:
Unix
January 07, 2009, 03:59 PM
GinnyJakes
Then do what Ken and I suggested and move them instead to MDYY fields, THEN convert using an equality to YYMD and do the subtract.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
January 08, 2009, 10:55 AM
IMblessed
The A25V field is Start_Date and the A10 field is Episode_Load_Date. The Start_dt1 field give me an error stating it (FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD:START_DT1.
Am I missing someting.


START_DT1/I8MDYY = EDIT(START_DATE,'99$99$9999');
START_DT2/MDYY = START_DT1;
EP_DT1/I8MDYY = EDIT(EPISODE_LOAD_DATE,'99$99$9999');
EP_DT2/MDYY = EP_DT1;
DAYS_DIFF/I6 = EP_DT2- START_DT2;


EDA764 Release * Current Software:
Unix
January 08, 2009, 11:13 AM
GinnyJakes
IM,

You can't do an edit/mask directly into an integer field. You either have to do a double edit or create an A first then an I. You are going to have the same problem with the other date. You might want to look in the Using Functions manual and read up on EDIT. Here is your code with the first date using the double EDIT.

START_DT1/I8MDYY = EDIT(EDIT(START_DATE,'99$99$9999'));
START_DT2/MDYY = START_DT1;
EP_DT1/I8MDYY = EDIT(EPISODE_LOAD_DATE,'99$99$9999');
EP_DT2/MDYY = EP_DT1;
DAYS_DIFF/I6 = EP_DT2- START_DT2;


I will leave you to fix the rest of it.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
January 08, 2009, 11:26 AM
IMblessed
Ginny
I has a senior moment
Thank you.


EDA764 Release * Current Software:
Unix