Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Pierre.Bru@spotimage.fr
Subject: Re: Y2K Conversion of Date to Internal Format
Date: 1998/08/24	[thread overview]
Message-ID: <6rs3tp$2t7$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 35DD8F5C.ED2765B7@idirect.com

In article <35DD8F5C.ED2765B7@idirect.com>,
  Jerome Fine <jhfine@idirect.com> wrote:
> >Pierre.Bru@spotimage.fr wrote:
> Jerome Fine replies:
>
> Thank you very much.  Do you have a reference for this algorithm?
> Very often, the source of some information leads to some more that
> is also useful.

this is 'ALGORITHM 199' of 'Association for Computiong Machinery' (ACM)

http://www.math.utah.edu/ftp/pub/tex/bib/toc/cacm1960.html
ftp://ftp.math.utah.edu/pub/tex/bib/cacm1960.html#Tantzen:1963:AAC

[...]
> > I can give you explanations for all these 'magic' numbers if you want.
>
> Thank you.  Rob Brown was able to do so already.  If you have a different
> interpretation, please add to the explanation.

I mean the magic-numbers in the posted DCL algorithm, not in yours.

[...]
> The above algorithms seem just fine.  But, unfortunately, although they
> are obviously great for the problem they solve, I cannot use either for
> the following 2 reasons:
> (a) The base year is not 26-Dec-1909 and the application programs
>       must keep compatible with the existing data base,  and

I know. this is a general algorithm to compute the julian day number from any
gregorain date. if you want the base date be 26-Dec-1909, compute the julian
day number for 26-Dec-1909, and substract this value from the result.

> (b)  They have too much code to fit in the same space as the original
>        algorithm which broke on 05-Feb-2000.

too much code ? the computation 'd/m/y'->'julian' is just :

$ if m.gt.2
$ then
$       m = m - 3
$ else
$       m = m + 9
$       y = y - 1
$ endif
$
$ c = y / 100
$ y = y - 100*c
$
$ j = c*146097/4 + y*1461/4 + (m*153 + 2)/5 + d + 1721119

the "big" part is for 'julian'->'d/m/y' ...
it can easilly be re-worked to be table-driven.

I'm not trying in any way to advocate this algorithm. I've just posted it
because I thouth it could help you to solve your problem.

Pierre.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum



  parent reply	other threads:[~1998-08-24  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
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 [this message]
1998-08-24  4:00           ` Martin Vorlaender
  -- strict thread matches above, loose matches on Subject: below --
1998-08-15  4:00 Jerome Fine
1998-08-17  4:00 ` Kevin Handy
1998-08-17  4:00 ` Jim Becker
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