home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mod201j.zip / modula2.exe / os2src / timedate.def < prev    next >
Text File  |  1995-06-16  |  2KB  |  85 lines

  1. DEFINITION MODULE TimeDate;
  2. (*
  3.     Title       : A group of time and date utilities
  4.     Limitations : Limited to dates 31 December 1899 to 4 June 2079
  5.     Author      : I.R. Matters (Ian.Matters@anu.edu.au)
  6.     System      : Juergen Neuhoff's Modula-2 compiler on OS/2 v3.0
  7.     Version     : 1.00
  8.     Last Edit   : 16 June 1995
  9. *)
  10.  
  11.  
  12. TYPE DateFormats = (Euro, US);
  13.  
  14.  
  15. PROCEDURE DateNow(): CARDINAL;
  16. (*
  17.    Returns the current date as a CARDINAL
  18.    containing the date serial number - 1 January 1900 = 1.
  19. *)
  20.  
  21.  
  22. PROCEDURE DateToStr (N: CARDINAL; F: DateFormats; VAR S: ARRAY OF CHAR);
  23. (*
  24.    Convert a date serial number to a "DD/MM/YYYY" or
  25.    "MM-DD-YYYY" date string - day 1 = 1 January 1900
  26. *)
  27.  
  28.  
  29. PROCEDURE SerialNumberToDate (N: CARDINAL; VAR Y, M, D: CARDINAL);
  30. (*
  31.    Convert a date serial number to a date - 1 January 1900 = 1
  32. *)
  33.  
  34.  
  35. PROCEDURE DateToSerialNumber (Y, M, D: CARDINAL): CARDINAL;
  36. (*
  37.    Convert a date to a date serial number - 1 January 1900 = 1
  38. *)
  39.  
  40.  
  41. PROCEDURE TimeNow(): LONGCARD;
  42. (*
  43.    Returns the current time of day as a LONGCARD
  44.    containing the number of seconds since midnight.
  45. *)
  46.  
  47.  
  48. PROCEDURE TimeToStr (N: LONGCARD; VAR S: ARRAY OF CHAR);
  49. (*
  50.    Convert a time serial number to a "HH:MM:SS" time string
  51. *)
  52.  
  53.  
  54. PROCEDURE SerialNumberToTime (N: LONGCARD; VAR H, M, S: CARDINAL);
  55. (*
  56.    Convert a "HH:MM:SS" time serial number to hours, minutes and seconds
  57. *)
  58.  
  59.  
  60. PROCEDURE TimeToSerialNumber (H, M, S: CARDINAL): LONGCARD;
  61. (*
  62.    Convert a time to a time serial number - seconds since midnight
  63. *)
  64.  
  65.  
  66. PROCEDURE TimeStrToTime (TS: ARRAY OF CHAR; VAR H, M, S: CARDINAL);
  67. (*
  68.    Convert a time string to hours, minutes and seconds
  69. *)
  70.  
  71.  
  72. PROCEDURE LeapYear (Y: CARDINAL): BOOLEAN;
  73. (*
  74.    Is the year a leap year?
  75. *)
  76.  
  77.  
  78. PROCEDURE DaysInMonth (Y, M: CARDINAL): CARDINAL;
  79. (*
  80.    How many days are in a given month?
  81. *)
  82.  
  83.  
  84. END TimeDate.
  85.