From: Jerome Fine <jhfine@idirect.com>
Subject: Y2K Conversion of Date to Internal Format
Date: 1998/08/15 [thread overview]
Message-ID: <35D63BEB.2A9533BB@idirect.com> (raw)
I am in the process of converting some application
programs which have been written in FORTRAN.
The complete package uses an internal DATE value
which starts on 26-Dec-1909 as 0 and increases for
each day. The algorithm which is broken is:
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
where all variables are 16 bit integers. Obviously the value overflows and
becomes negative on 13-Sep-1999 which is exactly what is wanted.
I have taken a few liberties with the FORTRAN code since I wanted
to make the algorithm clear.
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. There is also a routine which works in
the opposite direction which just ignores the first set of duplicate days
from 06-Feb-2000 to 29-Feb-2000.
(A) Is anyone familiar with an algorithm which works to convert
to the internal format and in the reverse direction?
(B) The size is important since I MUST patch the application
programs, NOT compile and link.
I suspect that someone thought we should revert to the old
calendar when those 11? days were lost and give everyone a
change to live 24 days a second time. Anyone remember
the names of the old and the present calendar which was
modified to take into account those extra leap years? I
though a bit of humour might make the question a bit
more interesting?
Sincerely yours,
Jerome Fine
RT-11/TSX-PLUS User/Addict
Year 2000 Solutions for Legacy RT-11 Applications
(Sources not always required)
next reply other threads:[~1998-08-15 4:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-08-15 4:00 Jerome Fine [this message]
1998-08-17 4:00 ` Y2K Conversion of Date to Internal Format Jim Becker
1998-08-17 4:00 ` Kevin Handy
1998-08-20 4:00 ` George Cornelius
-- strict thread matches above, loose matches on Subject: below --
1998-08-17 4:00 Jerome Fine
1998-08-19 4:00 ` Rob Brown
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 ` Pierre.Bru
1998-08-24 4:00 ` Martin Vorlaender
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