home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
4datef.exe
/
DOW.BTM
next >
Wrap
Text File
|
1992-10-20
|
2KB
|
65 lines
@echo off^goto dow_start
:dow_help
text
DOW - Day of week. Returns the day of week as a number or a string.
Command line usage: DOW [/e |/el |/f |/fl |/? ] [<date>]
Batch file usage: DOW [/e |/el |/f |/fl |/? ] [<date_variable>]
- Day of week is returned in the variable, if given.
Numeric return values are from 0 (Monday) to 6 (Sunday).
<Date> defaults to the current system date. Format depends on country
settings. Only dates between years 1980 and 2079 are valid.
Switches: /n - Output format: numeric, Monday=0 (default)
/e - english, shortcut
/el - english, long
/f - finnish, shortcut
/fl - finnish, long
/? - This help screen
endtext
return
:dow_start
if %_batch eq 1 setlocal
if "%debug" eq "%@name[%0]" echo on
:switch_loop
iff "%@substr[%1,0,1]" eq "/" then
if "%1" eq "/?" (gosub DOW_help^quit)
set Dow_f=%@lower[%@substr[%1,1]]
iff %@index[f;fl;e;el;?;,%Dow_f;] eq -1 .or. "%Dow_f" eq "" then
if %_batch eq 1 echo DOW: Invalid switch: %1
quit 2
endiff
shift
goto switch_loop
endiff
iff "%1" eq "" then
set Dt=%@date[%_date]
elseiff %_batch eq 1 then
set Dt=%@date[%1]
else
set Dt=%@date[%[%1]]
endiff
set Dow=%@eval[(%Dt+1)%%7]
iff "%[Dow_f]" eq "f" then
set Dow=%@word[%Dow,Ma Ti Ke To Pe La Su]
elseiff "%[Dow_f]" eq "fl" then
set Dow=%@word[%Dow,Maanantai Tiistai Keskiviikko Torstai Perjantai Lauantai Sunnuntai]
elseiff "%[Dow_f]" eq "e" then
set Dow=%@word[%Dow,Mon Tue Wed Thu Fri Sat Sun]
elseiff "%[Dow_f]" eq "el" then
set Dow=%@word[%Dow,Mon Tues Wednes Thurs Fri Satur Sun]day
endiff
iff %_batch gt 1 .and. "%1" ne "" then
set %1=%Dow
else
echos %Dow
endiff
unset Dt Dow >& nul