home *** CD-ROM | disk | FTP | other *** search
- (*****************************************************************************)
- (* *)
- (* filename : XDATES.PAS *)
- (* author : Stefan Boether / Compuserve Id : 100023,275 *)
- (* FidoNet : 2:242/200 *)
- (* FidoNet : 2:243/91 *)
- (* Internet: 100023.275@CompuServe.COM *)
- (* Maus-Net: Stefan Böther @ HRO *)
- (* system : TURBO 6.01 / TPW 1.5 / DOS 3.3 / WIN 3.1 *)
- (* changes : *)
- (* when what who *)
- (*---------------------------------------------------------------------------*)
- (* 02.04.91 inital release Stefc *)
- (* 25.04.92 one unit for all date/time functions Stefc *)
- (* 19.05.92 new function valid_time Stefc *)
- (* 01.09.92 renamed from DATES to XDATES Stefc *)
- (*****************************************************************************)
- (* Description : Gernal date & time functions that I need *)
- (*****************************************************************************)
-
- UNIT XDates;
-
- {$IFDEF Windows }
- {$D-,L-}
- {$ELSE }
- {$O+,D-,L-}
- {$ENDIF}
-
- INTERFACE
-
- USES {$IFDEF Windows }
- WinDos;
- {$ELSE}
- Dos;
- {$ENDIF}
-
- CONST Sunday = 0;
- Monday = 1;
- Tuesday = 2;
- Wednesday = 3;
- Thursday = 4;
- Friday = 5;
- Saturday = 6;
-
- TYPE Date = record (* compatible type to Btrieve Record Manager *)
- Day : BYTE;
- Month : BYTE;
- Year : WORD;
- end;
-
- dtoc = ARRAY[1..SIZEOF(Date)] OF CHAR;
-
- Time = record (* compatible type to Btrieve Record Manager *)
- Sec100: BYTE;
- Sec : BYTE;
- Min : BYTE;
- Hour : BYTE;
- end;
- ttoc = ARRAY[1..SIZEOF(Time)] OF CHAR;
-
- FUNCTION date_to_int( Datum : Date ) : LONGINT;
- (* change a date-structure to julian *)
-
- PROCEDURE int_to_date( Julian : LONGINT; VAR Datum : DATE );
- (* change a julian date back to a date-structure *)
-
- FUNCTION day_of_week( Datum : Date ) : BYTE;
- (* return the dayofweek for the given date.
- Sunday=0 .. Saturday=1 *)
-
- FUNCTION leap_year( Datum : Date ) : BOOLEAN;
- (* return true if the given date is a lear-year *)
-
- FUNCTION week_of_year( Datum : Date ) : INTEGER;
- (* return the number of the week within the year *)
-
- PROCEDURE set_date( D,M,Y : WORD; VAR Datum : Date );
- (* move the single parameters to a date-structure *)
-
- PROCEDURE sysdate( VAR Datum : Date );
- (* Return the day from the system *)
-
- PROCEDURE set_time( H,M,S : WORD; VAR Zeit : Time );
- (* move the single parameters to a time-structure *)
-
- PROCEDURE systime( VAR Zeit :Time );
- (* Return the actual systemtime *)
-
- PROCEDURE Unix_to_DateTime( Date : LongInt; Var Datum : Date; Var Zeit : Time );
- (* Convert a LongInt in the Unix flavor to separate variables *)
- (* Original code submitted by Mick Howland of f660.n690.z3.fidonet.org *)
- (* Modified by Brian Stark of p8.f3.n289.z1.fidonet.org *)
-
- PROCEDURE px_to_date( PxDate : LONGINT; VAR Datum:Date );
- (* Change a Paradox-Datefield to my date-structure *)
-
- FUNCTION date_to_px( Datum:Date ) : LONGINT;
- (* Change my date-structure to paradox dateformat *)
-
- FUNCTION valid_date( Datum:Date ):BOOLEAN;
- (* Check if the date is a valid one *)
-
- FUNCTION valid_time( Zeit:Time ):BOOLEAN;
- (* Check if the time is a valid one *)
-
-