Announcement

Collapse
No announcement yet.

Y2K in PB libraries?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Y2K in PB libraries?

    I don' t know whether this has been noted in other messages. Using DtaDate function from the PB library, to get the date stamp of a file that is Jan 4, 2000, Dos2Date returns Year=100 to DtaDate (and i think it' s ok), then the MakeDate returns a date with the year = 100. Probably in the block

    IF Year < 80 THEN 'assume we've rolled into the next century
    INCR Year, 2000
    ELSEIF Year < 100 THEN 'between 1980 and 1999
    INCR Year, 1900
    END IF

    the ELSEIF should be

    ELSEIF Year <= 100 THEN 'between 1980 and 2000.

    I don' t know whether this is the right solution, in case i will wonder next year..

    Davide Vecchi
    [email protected]

  • #2
    Funny you mention this...I just found this today as well. My solution was like this :

    in DATEUNIT.BAS, FUNCTION MakeDate(...) :

    Code:
    IF Year < 80 THEN  'assume we've rolled into the next century
      INCR Year,2000
    ELSE
      INCR Year,1900
    END IF
    This seemed to fix it on my computer as I was getting 100 for the Year variable. Assuming that 2001 will give a Year of 101 then it should keep working.

    I haven't tested this for future years, however.


    HTH,
    Jason McCarver
    [email protected]


    [This message has been edited by Jason McCarver (edited January 04, 2000).]

    Comment


    • #3
      Yes.. looking better at it after reading your post, i see that if 2001 will return year = 101, then my solution is really limited to the current year 2000 (it has just started and i' m already longing for it to end..). Let me go to change my solution into the yours, who knows my users will resist to my code one year long... Thanks.

      Davide Vecchi
      [email protected]

      Comment


      • #4
        From Paul Toppins
        --------------------------------
        Davide:

        Thanks for your e-mail message yesterday. I am afraid that Jason's solution will not always work, however, because sometimes the date passed to the function has the full four-digit date.
        In those instances, the default incrementing would make the date change to 3900.

        I changed the ELSEIF part to read,
        ELSE
        IF Year < 1900 THEN
        INCR Year, 1900
        END IF
        END IF

        I think this does it, at least for most dates that could conceivably be passed to a program.

        Please let me know what you think. (I would post this to the PB Forum, but I still need to register and I just haven't gotten round to do it.)

        --Paul Toppins
        [email protected] or
        [email protected]

        Comment

        Working...
        X