研究了下,两个算法等价,都正确 | :date2i <year> <month> <day> <RetVarName> // 一楼计算公式 | | setlocal&set/a y=%1,m=%2,d=%3 | | set/am+=9,m%%=12,y-=m/10,i=365*y+y/4-y/100+y/400+(m*153+2)/5+d-1 | | endlocal&if %4.==. (echo %i%)else set %4=%i% | | goto:eofCOPY |
| :Gauss_date2i <year> <month> <day> [RetVarName] // Gauss 日期计算公式 | | setlocal&set/a "y=%1,m=%2-2,d=%3 | | if %m% leq 0 set/a m+=12,y-=1 | | set/a i=365*y+y/4-y/100+y/400+367*m/12+d-31 | | endlocal&if %4.==. (echo %i%)else set %4=%i%COPY |
|