Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: "Rob Brown" <robbrown@shaw.wave.ca>
Subject: Re: Y2K Conversion of Date to Internal Format
Date: 1998/08/19	[thread overview]
Message-ID: <01bdcac2$35061860$7df84018@fsys.wave.shaw.ca> (raw)
In-Reply-To: 35D8AD45.458E8C95@idirect.com



Jerome Fine <jhfine@idirect.com> wrote in article
<35D8AD45.458E8C95@idirect.com>...
> DATE = CONVRT ( MONTH, DAY, YEAR )
> MONTH = MONTH - 2
> IF ( MONTH .LE. 0 ) MONTH = MONTH + 12; YEAR = YEAR - 1
> Q = YEAR / 100
> R =  YEAR - Q * 100
> DATE = ( YEAR - 1910 ) * 365   +   Q / 4   +   R / 4   +
>                                    ( MONTH + 1 ) * 28   +   ( 26 *
MONTH - 2 ) / 10

DAY is missing from the DATE formula as shown here, but that is not
really relevant to the problem at hand.

> The problem is that the algorithm BREAKS on 01-Mar-2000 at which
> point the DATE value reverts to the same value as for 06-Feb-2000
> and 24 duplicates are created.

March 1 2000 is the first day that 2000 rather than 1999 is used in
the DATE formula, and date that Q/4 changes value.  (26*MONTH-2)
equals 24 on that date, although I can't see what that has to do with
anything.  The problem obviously has something to do with the 1999 ->
2000 transition, but I can't see what it is right now.  I'm sure the
formula is fixable but I don't have time to look at it again until
tonight.

Hope this helps

- Rob



  reply	other threads:[~1998-08-19  4:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-17  4:00 Y2K Conversion of Date to Internal Format Jerome Fine
1998-08-19  4:00 ` Rob Brown [this message]
1998-08-19  4:00   ` Rob Brown
1998-08-19  4:00     ` Jerome Fine
1998-08-20  4:00       ` Pierre.Bru
     [not found]       ` <199808201251.HAA30561@x8.dejanews.com>
1998-08-21  4:00         ` Jerome Fine
1998-08-21  4:00           ` D.Webb
1998-08-22  4:00           ` Brian Inglis
1998-08-23  4:00           ` Charles Richmond
1998-08-24  4:00           ` Martin Vorlaender
1998-08-24  4:00           ` Pierre.Bru
  -- strict thread matches above, loose matches on Subject: below --
1998-08-15  4:00 Jerome Fine
1998-08-17  4:00 ` Jim Becker
1998-08-17  4:00 ` Kevin Handy
1998-08-20  4:00 ` George Cornelius
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox