Dec 242017
 
A TP 4.0+ unit that handles Julian numbers. Includes full source code.
File SHDTPK.ZIP from The Programmer’s Corner in
Category Pascal Source Code
A TP 4.0+ unit that handles Julian numbers. Includes full source code.
File Name File Size Zip Size Zip Type
SHDATEPK.DOC 5629 1855 deflated
SHDATEPK.PAS 4524 1162 deflated
TESTDATE.PAS 1993 787 deflated

Download File SHDTPK.ZIP Here

Contents of the SHDATEPK.DOC file





ShDatePk
========

{Part of the SkyHawk collection of TP development tools}
{Copyright 1988-90 by W.G. Madison and Associates, Ltd.}
{All rights reserved.}

{This product, in either compiled or source form,
together with all associated files and documents
is proprietary to Madison and Associates. All
rights reserved. Exportation of this program or
any of its component files or documentation in any
form to member countries of the European Economic
Community (EEC) without express written permission
of the author or Madison and Associates is
forbidden.}

ShDatePk is a set of procedures intended to simplify the accurate
manipulation of dates. These procedures are based on Algorithm
#398 and associated comments, from the Collected Algorithms of
the ACM.

Originally distributed as DATEPACK for TURBO/PASCAL ver. 3 (and
compatible with ver. 4), the routines relied heavily on Real
arithmetic. Re-written here for ver. 4 and above, all Real arith-
metic has been replaced by LongInt. This results in a speed-up of
nearly 60%, over the original DATEPACK routines compiled with real
arithmetic but without a math coprocessor.


Author: W.G. Madison
W.G. Madison and Associates, Ltd.
P.O. Box 898
Greenbelt, MD 20768-0898
(CompuServe 73240,342)

Date: November 1987
Revised:February 1990

Before proceeding, several definitions are necessary to provide
the framework for understanding the various conversions possible
through the use of the ShDatePk procedures.


GREGORIAN DATE

is the date system commonly used in modern western
nations. Established by Papal bull in March 1582, it
adjusted the calendar in use up to that time in order to
restore the vernal equinox to March 21. This was accomp-
lished by suppressing the dates from the 5th through the
14th (inclusive) of October, 1582. While the Gregorian
calendar was accepted quickly throughout most of Europe,
it was not adopted in England and the Colonies until
1752. When YEAR, MONTH, and/or DAY are passed or return-
ed as parameters in the ShDatePk procedures, the Gre-
gorian system is assumed.


JULIAN DAY-NUMBER, or JULIAN DAY

is the representation of a given date as its serial
index, beginning on January 1, 4713 B.C. The date chosen
as the basis has astronomical significance, and is wide-
ly recognized in the scientific community. Proposed by
the astronomer Joseph Scaliger, it is named in memory of
his father and not, as often assumed, for Julius Caesar.
When used as a parameter by any of the ShDatePk rou-


1



tines, it will be passed as a LongInt representation of
a 7 digit integer.


JULIAN DATE

is the representation of a given date as its serial
index, taking January 1st of the given year as the base
(=1). When used as a parameter by any of the ShDatePk
procedures, both the serial index and the year will be
represented as simple integers. (By the way, this one
was named for Julius Caesar).


SMITHSONIAN DATE

is the representation of a given date as its serial
index, with November 18, 1858 as the base (=1). While
procedures are not included for converting from or to
the Smithsonian date, it is readily calculated from the
Julian Day as

Smithsonian = Julian - 2400001


































2



The following procedures are included in ShDatePk.

Gregorian2JulianDN(Year, Month, Day : Integer;
var JulianDN : LongInt);

computes the Julian Day-Number from the Gregorian date.


*********************

JulianDN2Gregorian(JulianDN : LongInt;
var Year, Month, Day : Integer);

computes the Gregorian date from the Julian Day-Number.


*********************

Gregorian2JulianDate(Year, Month, Day : Integer;
var JulianDate : Integer);

computes the Julian date from the Gregorian date.


*********************

Julian2GregorianDate(JulianDate, Year : Integer;
var Month, Day : Integer);

computes the Gregorian date from the Julian date.


*********************

DayOfWeek(Year, Month, Day : Integer; var DayOfWeek : Integer);

computes the day of the week (Sunday = 1; Saturday = 7) from
the Gregorian date.



















3



 December 24, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)