home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Big Blue Disk 22
/
bbd22.zip
/
DATES.TXT
< prev
next >
Wrap
Text File
|
1988-05-20
|
10KB
|
178 lines
|D╔══════════════════╗════════════════════════════════════════════════════════════
|D║ |5The Happy Hacker |D║════════════════════════════════════════════════════════════
|D╚══════════════════╝════════════════════════════════════════════════════════════
^C^1Dates
^C(DHDATES.OBJ & DHDATES3.OBJ)
^Cby
^CDan Harrison
Dhdates & Dhdates3 are subprograms designed to be used with Microsoft
QuickBASIC version 3.0 -- DHDATES is used with the BCOM30 library, and DHDATES3
is used with the BRUN30 library.
Have you ever wondered why BASIC just can't handle dates properly. Oh yes, it
will give you the current date and even build a date from the month, day, and
year. But what if you want more in your programs? Like what day of the week is
it? How about dates before 1980? How many days between two dates? What is the
true Julian date? How about a date format which humans are used to? When is
Easter in the year 2045 or when was Washington's birthday in 1912? Dhdates can
do this and so much more - AND very quickly and easily in your own custom built
QuickBasic compiled programs. Dhdates gives accurate information for years
inclusive of 1900 to 2100.
The calling syntax for Dhdates (or Dhdates3) is
CALL DHDATES(OPERATION%,JD!,WEEK%,ZDATE$,JDAY%,MONTH%,DAY%,YEAR%,YDATE$)
After compiling your program containing a call to Dhdates, link your program
with Dhdates in the following manner (example: your program name in this
example is `yourprogram'):
LINK yourprogram+DHDATES
The following information will be returned from each call to Dhdates:
1. JD! - this is the true Julian date where the Julian date
of 1 was January 1, -4713 when three astrological
events occurred simultaneously. JD! returns -1 if
an error of input has been detected (such as a date
outside of the range indicated above).
2. Week% - this is the day of the week where 0 is Sunday and
6 is Saturday.
3. Zdate$ - this is the normal computer composite date in
the form of 02-19-1988.
4. Jday% - this is the day of the year where January 1 is 1
and December 31 is either 365 or 366 depending on
if it is leap year.
5. Month% - this is the month which is a number from 1 to 12.
6. Day% - this is the day of the month which is a number from
1 to 31 depending on the month.
7. Year% - this is the year as a number from 1900 to 2100.
8. Ydate$ - this is a more elegant form of the date such as
December 12, 1955.
Call variables:
o Operation% - a number from 1 to 7 -- see the table below.
o JD! - a single precision number. range 2415021 to 2488434.
o Week% - an integer of the day of the week from 0 to 6.
o Zdate$ - a composite date such as 02-17-1977.
o Jday% - an integer for the day of the year (or holiday code).
o Month% - an integer for the month from 1 to 12.
o Day% - an integer for the day of the month from 1 to 31.
o Year% - an integer for the year from 1900 to 2100.
o Ydate$ - a returned string only.
NOTE: this is a list of all the variables used to
call or return from Dhdates. Only the
variables listed in the table need to be sent
to the subroutine, however all the variables
are returned from the subroutine.
OPERATION CODES: (send these variables to the subprogram)
╔═════════════════════════════════════════════════════════════════════════════╗
║ Function Operation% JD Week% Zdate$ Jday% Month% Day% Year% Ydate$║
║ ║
║Convert Date ║
║Gregorian 1 - - to - - - - - ║
║to Julian convert ║
║ ║
║Find date ║
║X days 2 - - Start - #days - - - ║
║to/from ║
║a date ║
║ ║
║Find week- ║
║day in Day Date ║
║a week 3 - of the in the - - - - - ║
║containing week week ║
║the date ║
║ ║
║Convert Julian ║
║Julian 4 date - - - - - - - ║
║ to ║
║Gregorian ║
║ ║
║Build a ║
║date from 5 - - - - Month Day Year - ║
║month, day, ║
║and year ║
║ ║
║Find date ║
║ of a 6 - - - Holiday - - Year - ║
║ holiday see chart ║
║ ║
║Find date ║
║from day 7 - - - Day of - - Year - ║
║of year ║
╚═════════════════════════════════════════════════════════════════════════════╝
HOLIDAYS (Operation%=6)
JDAY% Holiday Date Calculated
───── ────────────── ───────────────
1 New Year's Day January 1
2 Groundhog Day February 2
3 Lincoln's Birthday February 12
4 Valentine's Day February 14
5 President's Day 3rd Monday in February
6 Washington's B'day February 20
7 St. Patrick's Day March 17
8 April Fool's Day April 1
9 Ash Wednesday 40 Days before Easter
10 Palm Sunday Sunday before Easter
11 Good Friday Friday before Easter
1st Sunday after the
12 Easter 1st full moon after the
Spring Equinox
13 Arbor Day Last Friday in April
14 May Day May 1
15 Mother's Day 2nd Sunday in May
16 Armed Forces Day 3rd Saturday in May
17 Memorial Day (celebrated) Last Monday in May
18 Memorial Day (actual) May 30
19 Father's Day 3rd Sunday in June
20 Independence Day July 4
21 Labor Day 1st Monday in September
22 Grandparent's Day 1st Sunday after Labor Day
23 Columbus Day 2nd Monday in October
24 Halloween October 31
25 All Saint's Day November 1
26 Election Day 1st Tuesday after the
1st Monday in November
27 Veteran's Day November 11
28 Thanksgiving 4th Thursday in November
29 Christmas December 25
30 New Year's Eve December 31
Two programs have been included here as a demonstration of what can be done
using the Dhdates subprogram:
DATEDEMO
────────
Datedemo is a demonstration program of each of the call parameters shown
above. It allows you to see the speed and accuracy of the Dhdates subprogram
and may give some insights to it's usefulness.
Initiate the Date Demo by typing `DATEDEMO' while in DOS, or selecting "Run
It" from the BIG BLUE DISK menu. The DATEDEMO.EXE file must be on the current
drive and directory since some data is read directly from the EXE file.
CALENDAR
────────
See "Read It" text for Calendar program in the Helpware department for more
information about this program.
DISK FILES THIS PROGRAM USES:
^FDHDATES.OBJ
^FDHDATES3.OBJ
^FDATEDEMO.EXE
^FBRUN30.EXE
^FRETURN30.EXE