home *** CD-ROM | disk | FTP | other *** search
- Program What_Day;
-
- {WhatDay June 6, 1990
- Ricky M. Lacy The Data Dimension PCBoard 404-921-1186 (HST 14,400)
-
- This program will determine what day of the week it is and return the
- appropriate errorlevel for use in batch files (1=Sunday, 2=Monday, etc).}
-
- uses dos; {we use the DOS unit to fetch the date}
-
- var year : word; {for simplicity, all variables are word type}
- month : word;
- day : word;
- dayofweek : word;
-
- begin {main}
- GetDate(year,month,day,dayofweek); {get the date from dos}
-
- dayofweek := dayofweek + 1; {our TPU returns 0 for Sunday, i don't
- like that, so i add 1 to it}
-
- case dayofweek of {let 'em know what we found}
- 1 : writeln('Today is Sunday, exit errorlevel 1');
- 2 : writeln('Today is Monday, exit errorlevel 2');
- 3 : writeln('Today is Tuesday, exit errorlevel 3');
- 4 : writeln('Today is Wednesday, exit errorlevel 4');
- 5 : writeln('Today is Thursday, exit errorlevel 5');
- 6 : writeln('Today is Friday, exit errorlevel 6');
- 7 : writeln('Today is Saturday, exit errorlevel 7');
- end;
- halt(dayofweek); {bail out and set the errorlevel}
- end. {main}