俺曾经写的:要求%date%格式为2010-01-02 ...- @echo off
- set/p D=请输入天数:
- for /f "tokens=1-3 delims=-:/ " %%a in ("%date%") do set/a Y=%%a,M=1%%b-100,D=1%%c-100-D
- if %D% leq 0 call:C %D%
- set M=0%M%&set D=0%D%
- echo %Y%-%M:~-2%-%D:~-2%
- pause&exit
- :C
- set/a M-=1,Y-=!M,M+=!M*12,"C=!(M-4)|!(M-6)|!(M-9)|!(M-11)","D+=!(M-2)*(28+(!(Y%%4)&!!(Y%%100))|!(Y%%400))+C*30+(!!(M-2)&!C)*31"
- if %D% leq 0 goto:C
复制代码
[ 本帖最后由 hanyeguxing 于 2010-12-28 09:48 编辑 ] |