Using quiz to determine number of da

pickerij@norbord.com pickerij@norbord.com
Mon, 15 Feb 1999 15:40:13 -0500


Good grief Shawn, no wonder you're not a fan of Powerhouse :-) What a   
lovely example of Quiz code gone amuck!

I would recommend that the dictionary indicates "century INcluded"   
regardless of what is physically stored on the discs. Then override that   
global default for each place you actually still want a 6 digit date.

Then the following code will work just fine:
     > define eight-digit-date date &
     > = addcentury(six-digit-date, century(six-digit-date))

Regards,
John Pickering
Toronto

 -----Original Message-----
From: Shawn_Gordon@Notes.FH.Com
Sent: Monday, February 15, 1999 3:18 PM
To: powerh-l@lists.swau.edu
Subject: Using quiz to determine number of days b


We are having trouble calculating the number of days between two dates   
when
 the dates span the century, but do not contain the century. The CENTURY   
and
ADDCENTURY functions do not seem to work.
I have listed below the dictionary and some sample code. With the only   
item
 working being the IF logic.


DICTIONARY:
System Options &


   Century Excluded      Allow  Century           &
   Input Century 19 From Year 50                  &
   Date Separator "/"    Date Format     MMDDYY   &


   Release 0   Version  0   Show   &


   Special Name Characters "-_'%#" &
   Decimal "." &
   Generic Retrieval Character "@" &
   Multiline Heading Character "^" &
   Picture Substitution Character "^"   &
   Message Substitution Character "^"   &
   Sysmonths "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"    &
   ASCII7 Character Set ENGLISH


CODE:
>SET DICT PHD.SRC
>
> DEF X1 DATE = 991215
> DEF X2 DATE = 000131
>
> DEF Y1 NUM*10 = DAYS(X2) - DAYS(X1) IF X2>500000 AND X1<500000 ELSE &
>                (DAYS(X2) - DAYS(000101)) + (DAYS(991231) - DAYS(X1)) +   
1
>
> DEF X3 DATE = 981215
> DEF X4 DATE = 990131
> DEF Y2 NUM*10 = DAYS(X4) - DAYS(X3)
>
> DEF Y3 NUM*10 = DAYS(CENTURY(X2)) - DAYS(CENTURY(X1))
>
> DEF X5 DATE CENTURY INCLUDED = CENTURY(991215)
> DEF X6 DATE CENTURY INCLUDED = CENTURY(000131)
>
> DEF Y4 NUM*10 = DAYS(X6) - DAYS(X5)
>
> REPORT X1 X2 Y1 SKIP 1 &
> X3 X4 Y2 SKIP 1 &
> Y3 SKIP 1 &
> X5 X6 Y4
> GO


RESULTS:


  12/15/99  01/31/00           47
  12/15/98  01/31/99           47
            0
                                0


= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.