Focal Point
[CLOSED] Date Difference

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

March 13, 2012, 12:37 PM
DavidGarcia
[CLOSED] Date Difference
Hello there

I am trying to find the difference between 2 dates.
Here are my defines:

DATE1/YYMD = DATEFIELD (originally HYYMDS Format)
DATE2/ YYMD = &YYMD
DAYS/I8 = DATEDIF (DATE2 , DATE1 , 'D')

This is what I get:


DATE1 DATE2 DAYS
2012/01/02 2012/03/13 1900/10/21
2012/01/03 2012/03/13 1900/10/22
2012/01/04 2012/03/13 1900/10/23
2012/01/05 2012/03/13 1900/10/24

Shouldn´t I be getting this???

DATE1 DATE2 DAYS
2012/01/02 2012/03/13 71 2012/01/03 2012/03/13 72
2012/01/04 2012/03/13 73
2012/01/05 2012/03/13 74

I am using the report assistant since I am not a developer. Hope somebody can help me out.

Regards
David

This message has been edited. Last edited by: Kerry,


Webfocus 7.7.03
March 13, 2012, 12:56 PM
j.gross
With YYMD format, the date is held internally as an offset, so a simple direct subtraction...

DAYS/I8C = DATE2-DATE1;

gives the difference.

N.B.
It's better practice to reference &YYMD in quotes, when assigning it to a YYMD variable:

DATE2/YYMD = '&YYMD';

-- to make certain that &YYMD=20120313 won't give you a date some 20 million+ days in the future.