『第
4 楼』:
这不是纯P版的,但厉害,我不懂vbs,以前写了纯p版的(可计算任意日期),发给楼主了:
@echo off
:begin
cls
set /p var=输入要计算的日期(格式为2000-01-01):
if "%var:~4,1%%var:~7,1%"=="--" goto year
cls
echo 输入格式不正确!请返回正确输入。&ping /n 2 127.1>nul&goto begin
:year
set year=%var:~,4%
set /a str=%year%-%year%/4*4
:month
if %var:~5,1% equ 0 (set month=%var:~6,1%) else (set month=%var:~5,2%)
if %month% gtr 2 (
if %str% equ 0 (
set /a number+=29
) else (
set /a number+=28
)
)
set /a month-=1
if %month% gtr 0 for /l %%i in (1,1,%month%) do call :lp %%i
:day
if %var:~8,1% equ 0 (set /a number=%number%+%var:~9,1%) else (set /a number=%number%+%var:~8,2%)
cls
echo %var%是%year%年的第%number%天&set number=0
pause>nul&goto :eof
:lp
for %%i in (1,3,5,7,8,10) do if %%i equ %1 set /a number+=31
for %%i in (4,6,9,11) do if %%i equ %1 set /a number+=30
goto :eof [ Last edited by zw19750516 on 2008-4-16 at 06:40 PM ]
|