echo %date%
结果贴出来看看
@echo off
call :DateToDOW %date:~0,4% %date:~5,2% %date:~8,2% dow
echo 星期%dow%
goto :eof
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:DateToDOW %yy% %mm% %dd% dow
::
:: By: Ritchie Lawrence, 2003-04-29. Version 1.1
::
:: Func: Creates a day of week number from a calendar date, where 1 = Mon
:: and 7 = Sun. For NT4/2000/XP/2003.
::
:: Args: %1 year component to be converted, 2 or 4 digits (by val)
:: %2 month component to be converted, leading zero ok (by val)
:: %3 day of month to be converted, leading zero ok (by val)
:: %4 var to receive day of week number, 1 to 7 (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS
set yy=%1&set mm=%2&set dd=%3
if 1%yy% LSS 200 if 1%yy% LSS 170 (set yy=20%yy%) else (set yy=19%yy%)
set /a dd=100%dd%%%100,mm=100%mm%%%100
set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,dow=153*m+2
set /a dow=dow/5+dd+y*365+y/4-y/100+y/400-2472630,dow%%=7,dow+=1
endlocal&set %4=%dow%&goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Last edited by HAT on 2008-11-29 at 12:10 ]