home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol023 / dastrlon.lib < prev    next >
Text File  |  1984-04-29  |  2KB  |  67 lines

  1.  
  2. {    DASTRLONG
  3.  
  4.     This takes an integer date value and returns a string with all
  5.     words spelled out.
  6.  
  7.     If WITHDAY is passed as true then the returned string will
  8.     include the day of the week, otherwise only month, day and
  9.     year will be returned.
  10.  
  11.     The following global types must be declared:
  12.         TYPE    string255 = string 255;
  13.             byte = 0..255;
  14.  
  15.     The following additional procedures must be declared:
  16.         PROCEDURE breakdate;
  17.         PROCEDURE setlength; external;
  18. }
  19.  
  20. FUNCTION dastrlong (days : integer; withday : boolean) : string255;
  21.  
  22. CONST    zero = 48;
  23.  
  24. VAR    day, mo, date, yr : byte;
  25.     str, str2 : string255;
  26.  
  27. begin
  28.     brkdate (days,mo,date,yr,day);
  29.     if withday then
  30.         begin
  31.         case day of
  32.             0 : str := 'Sunday';
  33.             1 : str := 'Monday';
  34.             2 : str := 'Tuesday';
  35.             3 : str := 'Wednesday';
  36.             4 : str := 'Thursday';
  37.             5 : str := 'Friday';
  38.             6 : str := 'Saturday'
  39.             end;
  40.         append (str,', ')
  41.         end
  42.         else setlength (str,0);
  43.      case mo of
  44.         1 : str2 := 'January';
  45.         2 : str2 := 'February';
  46.         3 : str2 := 'March';
  47.         4 : str2 := 'April';
  48.         5 : str2 := 'May';
  49.         6 : str2 := 'June';
  50.         7 : str2 := 'July';
  51.         8 : str2 := 'August';
  52.         9 : str2 := 'September';
  53.         10 : str2 := 'October';
  54.         11 : str2 := 'November';
  55.         12 : str2 := 'December'
  56.         end;
  57.     append (str,str2);
  58.     append (str,' ');
  59.     if (date > 9) then append (str,chr((date div 10) + zero));
  60.     append (str,chr((date mod 10) + zero));
  61.     append (str,', 19');
  62.     append (str,chr((yr div 10) + zero));
  63.     append (str,chr((yr mod 10) + zero));
  64.     dastrlong := str
  65. end;
  66.  
  67.