『第
32 楼』:
头大了 没详细测试
@echo off
set/p times=输入年月日小时分
for /f "tokens=1-5 delims= " %%a in ("%times%") do set /a yy=%%a,mm=%%b,tt=%%c,hh=%%d,ss=%%e
for /f "tokens=1-3 delims=-/\:. " %%i in ("%date%") do set /a p1=%%i,p2=100%%j%%100,p3=100%%k%%100
for /f "tokens=1-3 delims=:" %%i in ('time/t') do set /a t1=100%%i%%100,t2=100%%j%%100
set/a s2=ss%%60,t1-=ss/60%%24,t2-=s2,hh+=ss/60
if %t2% lss 0 set/a t2+=60
if %t1% lss 0 set/a t1+=24
set/a h1=hh%%24,tt+=(hh-h1)/24,t1-=h1
if %t1% lss 0 set/a t1+=24,tt+=1
set/a p1-=yy
set/a m2=mm%%12,p1-=(mm+p2)/12,p2-=m2
if %p2% leq 0 set/a p2+=12
if %p3% gtr %TT% goto ppp
:nxt
set/a p2-=1
if %p2% equ 0 set/a p1-=1&&set p2=12
set/a PN2="!(p1%%4) & !(!(p1%%100)) | !(p1%%400)",PN2=28+PN2
for /f "tokens=%p2%" %%i in ("31 %pN2% 31 30 31 30 31 31 30 31 30 31") do set/a p3=%p3%+%%i
if %p3% leq %tt% goto nxt
:ppp
set/a p3=%p3%-%tt%
setlocal enabledelayedexpansion
for %%i in (p2 p3 t1 t2) do if !%%i! lss 10 set %%i=0!%%i!
echo %p1%年%p2%月%p3%日%t1%时%t2%分
pause&goto :eof
|