home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / WHATDAY.ZIP / WHATDAY.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1990-06-06  |  1.2 KB  |  33 lines

  1. Program What_Day;
  2.  
  3. {WhatDay         June 6, 1990
  4.  Ricky M. Lacy   The Data Dimension PCBoard    404-921-1186   (HST 14,400)
  5.  
  6.  This program will determine what day of the week it is and return the
  7.  appropriate errorlevel for use in batch files (1=Sunday, 2=Monday, etc).}
  8.  
  9. uses dos;    {we use the DOS unit to fetch the date}
  10.  
  11. var year      : word;   {for simplicity, all variables are word type}
  12.     month     : word;
  13.     day       : word;
  14.     dayofweek : word;
  15.  
  16. begin     {main}
  17.     GetDate(year,month,day,dayofweek);    {get the date from dos}
  18.  
  19.     dayofweek := dayofweek + 1;   {our TPU returns 0 for Sunday, i don't
  20.                                    like that, so i add 1 to it}
  21.  
  22.     case dayofweek of    {let 'em know what we found}
  23.         1 : writeln('Today is Sunday, exit errorlevel 1');
  24.         2 : writeln('Today is Monday, exit errorlevel 2');
  25.         3 : writeln('Today is Tuesday, exit errorlevel 3');
  26.         4 : writeln('Today is Wednesday, exit errorlevel 4');
  27.         5 : writeln('Today is Thursday, exit errorlevel 5');
  28.         6 : writeln('Today is Friday, exit errorlevel 6');
  29.         7 : writeln('Today is Saturday, exit errorlevel 7');
  30.     end;
  31. halt(dayofweek);   {bail out and set the errorlevel}
  32. end.     {main}
  33.