home *** CD-ROM | disk | FTP | other *** search
-
- DateIt v.3a Copyright July 1988 by WardWares
-
-
- PURPOSE:
-
- Place all Date Manipulation Operations in one UNIT Library
- for easier access.
-
- IMPROVEMENTS:
-
- Added the windowing units so that others could compile the
- DateDemo program.
-
-
- FILES:
-
- In this version of DateIt you will find, unless infected:
-
- DATEIT.DOC - This Documentation file.
- WWDATEIT.TPU - The DateIt Unit.
- DATEDEMO.PAS - Source Code for the Demo.
- DATEIT.FRM - Registration Form.
- QWIK.TPU { }
- WNDW.TPU { Windowing Units. }
- WNDWVARS.TPU { }
-
- CREDITS:
-
- COPYRIGHT 1988 By WardWares
-
- If there are any problems or suggestions, I would like to hear
- from you. I can be reached during the days at (513) 896-5007
- or by FIDO NetMail at 108/10, ask for or send mail in care of
- Jim Ward. I will reply to all who are serious about working
- with or improving DateIt.
-
- SHAREWARE:
-
- For those first 10 people who are willing to pay $10 you will
- receive a copy of the source code on disk. After that the
- source will be sold for $25. All who register will be entitled
- to receive updates as they come and they will, for as soon as
- a package is producted someone says, "I wish it would do...."
-
- Send you checks to:
- WardWares
- 1130 NW Washington, Suite 4
- Hamilton, OH 45013
-
- DOCUMENTATION:
-
- This is in no way GREAT documentation, but it is better than what
- was presented in past additions, NOTHING. If you have any excellent
- suggestions or problems please send them to the above address.
- I would like to make this documentation clear to all.
-
-
-
-
- DateIt v.3a Copyright July 1988 by WardWares
-
- COMMANDS USED IN DateIt:
-
- The Date is set up as a RECORD of:
-
- dRec = RECORD
- m,d,y,w: WORD
- END;
-
- This represents m - Month, d - Day, y - Year, w - Day of Week.
- To use with the a Turbo Pascal v4.0 command such as GETDATE
- do the following.
-
- VAR {Your Program should set up a variable}
- Date: dRec; {of this type so you can pass date information}
- BEGIN {to DateIt's Functions.}
- ...
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- ...
- END.
-
- All of DateIt's functions use this type of packed date, let's
- take a look at our first function.
-
-
-
- FUNCTION: Julian(z: dRec): INTEGER;
-
- USAGE: VAR
- Date: dRec;
- v: INTEGER;
- BEGIN
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- v := Julian(Date); {Returns a number from 1-366
- according to date given}
- END.
-
-
-
-
- FUNCTION: LeapYear(y: WORD): INTEGER;
-
- USAGE: VAR
- Date: dRec;
- v: INTEGER;
- BEGIN
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- v := LeapYear(Date.y); {Returns a 1 if the Year is
- an actual Leap Year or a 0
- if it is NOT.}
- IF (v=1) THEN
- WRITELN('This is a Leap Year.')
- ELSE
- WRITELN('This is NOT a Leap Year.');
- END.
-
-
-
-
- DateIt v.3a Copyright July 1988 by WardWares
-
- FUNCTION: CkDate(z: dRec): BOOLEAN;
-
- USAGE: VAR
- Date: dRec;
- BEGIN
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- IF (CkDate(Date)) THEN {Returns TRUE if the
- WRITELN('This Date is Valid.') Date Given is Valid
- ELSE and FALSE if it is not}
- WRITELN('This Date is Invalid.');
- END.
-
-
-
-
-
- FUNCTION: MonStr(m: WORD;Style: mType): STRING;
-
- USAGE: VAR
- Date: dRec;
- aSt: STRING;
- BEGIN
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- aSt := MonStr(Date.m,Mon); {This passes the month in
- a 3 character format}
- aSt := MonStr(Date.m,Month); {This passes the month
- as a full string}
- END.
-
-
-
-
- FUNCTION: DayStr(w: WORD;Style: wTy): STRING;
-
- USAGE: VAR
- Date: dRec;
- aSt: STRING;
- BEGIN
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- aSt := DayStr(Date.d,Short); {This passes the weekday
- name in a 3 character format}
- aSt := DayStr(Date.d,Long); {This passes the weekday
- as a full string}
- END.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- DateIt v.3a Copyright July 1988 by WardWares
-
- FUNCTION: DateStr(z: dRec;Style: wTy;Dvd: sTy): STRING;
-
- USAGE: VAR
- Date: dRec;
- aSt: STRING;
- BEGIN
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- aSt := DayStr(Date,MDY4,Slash); {This a Date String with
- slashes, you can also use
- the either: Dash or Period
- in place of Slash
- (see DateDemo for all of
- the possible date formats)}
- END.
-
-
-
-
- PROCEDURE: ComputeDays(z: dRec;n: INTEGER;VAR x: dRec;Style: aTy);
-
- USAGE: VAR
- Date,Date2: dRec;
- BEGIN
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- ComputeDays(Date,100,Date2,Add); {This adds 100 days to
- Date and puts the answer
- in Date2}
- ComputeDays(Date,200,Date2,Sub); {This subtracts 200 from
- Date and puts the answer
- in Date2}
- END.
-
-
-
- PROCEDURE: Tomorrow(z: dRec;VAR x: dRec);
-
- USAGE: VAR
- Date,Date2: dRec;
- BEGIN
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- Tomorrow(Date,Date2); {Returns the date after the
- given Date an puts the result
- in Date2}
- END.
-
-
-
- PROCEDURE: Yesterday(z: dRec;VAR x: dRec);
-
- USAGE: VAR
- Date,Date2: dRec;
- BEGIN
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- Yesterday(Date,Date2); {Returns the date before the
- given Date an puts the result
- in Date2}
- END.
-
- DateIt v.3a Copyright July 1988 by WardWares
-
-
- FUNCTION: DiffDates(z,x: dRec;Style: nType): INTEGER;
-
- USAGE: VAR
- Date,Date2: dRec;
- v: INTEGER;
- BEGIN
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- Date2.y := 1988; Date2.m := 7; Date2.d := 18; Date2.w := 1;
- v := DiffDates(Date,Date2,Days); {Returns the number of days
- between Date and Date2}
- v := DiffDates(Date,Date2,Months); {Returns the number of
- months between Date
- and Date2}
- END.
-
-
-
-
- FUNCTION: CompareDates(z,x: dRec): BYTE;
-
- USAGE: VAR
- Date,Date2: dRec;
- v: BYTE;
- BEGIN
- GETDATE(Date.y,Date.m,Date.d,Date.w);
- Date2.y := 1988; Date2.m := 7; Date2.d := 18; Date2.w := 1;
- CompareDates(Date,Date2); {Returns a 0 if Date equals Date2,
- a 1 if Date is Greater than Date2
- and a 2 if Date is less than Date2}
- END.
-
-
-