China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-23 18:59
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Batch calendar View 4,044 Replies 23
Floor 16 Posted 2007-02-21 09:03 ·  中国 浙江 台州 温岭市 电信
高级用户
★★
DOS学徒
Credits 526
Posts 252
Joined 2007-02-12 05:35
19-year member
UID 79286
Gender Male
Status Offline
What Brother 12th Floor said, I'm a bit confused. Hehe
Floor 17 Posted 2007-03-05 00:33 ·  中国 吉林 长春 电信
初级用户
Credits 26
Posts 10
Joined 2007-02-22 00:10
19-year member
UID 79909
Gender Male
Status Offline
Bump
Floor 18 Posted 2007-04-24 10:28 ·  中国 江苏 无锡 电信
初级用户
Credits 80
Posts 43
Joined 2007-04-21 23:44
19-year member
UID 86017
Gender Male
Status Offline
Not bad. But didn't understand. Hehe
Floor 19 Posted 2007-04-24 10:39 ·  中国 浙江 杭州 联通
银牌会员
★★★
Credits 1,928
Posts 931
Joined 2007-01-06 11:46
19-year member
UID 75624
Gender Male
Status Offline
That's really well written.
Floor 20 Posted 2007-04-24 11:01 ·  中国 山东 淄博 联通
中级用户
★★
Credits 272
Posts 99
Joined 2006-06-02 09:12
20-year member
UID 56414
Status Offline
Support the building owner to add the function of querying dates for any year.
Believe that if you know what day of the week the first day of a year is, this function can be realized.
For any year year, the calculation formula for what day of the week the first day is is
(year + (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400) % 7
Note that the format here "/" is division, not the remainder, and "%" is the modulo operation. As long as the remainder
This year is 2007, then the first day can be calculated to be Monday
Floor 21 Posted 2007-04-24 12:36 ·  中国 山东 淄博 联通
中级用户
★★
Credits 272
Posts 99
Joined 2006-06-02 09:12
20-year member
UID 56414
Status Offline
By adding new code in the building code, different years can be displayed. Except for BC, it should be fine. All changes are within comments, and the rest of the parts are unchanged


@echo off
mode con: lines=12 cols=40
setlocal enabledelayedexpansion
for %%a in (一,二,三,四,五,六,日) do (
set /a a+=1
set j!a!=%%a)

for %%b in (31,28,31,30,31,30,31,31,30,31,30,31) do (
set /a y+=1
set s!y!=%%b)


::::::::::::::::::::::::::::::Add year function
set /p year=Check which year?
cls
set /a year_chk1=year%%400
set /a year_chk2=year%%4
set /a year_chk3=year%%100
if %year_chk1% equ 0 set s2=29
if %year_chk2% equ 0 if %year_chk3% neq 0 set s2=29
::::::::::::::::::::::::::::::End of addition

set /p m=Check which month?
cls
set n=%m%
set /a n-=1


for /l %%c in (1,1,%n%) do (
set /a day+=!s%%c!)


set b=0

for /l %%d in (1,1,!day!) do (
set /a b+=1
if !b! equ 8 set b=1)

if %m% equ 1 set b=7



echo 一 二 三 四 五 六 日
echo.
set flag= 一二三四五六日一二三四五六日

:::::::::::::::::::::::::::::::::Add year function
set /a yearflag=(%year%+(%year%-1)/4-(%year%-1)/100+(%year%-1)/400)%%7
if %yearflag% equ 1 goto endadjust
if %yearflag% equ 0 set yearflag=7
set /a yearflag-=1
set /a yeartemp=0-yearflag
set flag= !flag:~%yeartemp%!一二三四五六日一二三四五六日
set flag=!flag:~0,15!
echo %flag%>C:\ag.txt
:endAdjust
:::::::::::::::::::::::::::::::::End of addition

for /l %%f in (1 1 13) do (

if "!flag:~%%f,1!"=="!j%b%!" (
if "!j%%f!"=="一" (set /p s= <nul&set zh=6&goto next)
if "!j%%f!"=="二" (set /p s= <nul&set zh=5&goto next)
if "!j%%f!"=="三" (set /p s= <nul&set zh=4&goto next)
if "!j%%f!"=="四" (set /p s= <nul&set zh=3&goto next)
if "!j%%f!"=="五" (set /p s= <nul&set zh=2&goto next)
if "!j%%f!"=="六" (set /p s= <nul&set zh=1&goto next)
if "!j%%f!"=="日" (set /p s=<nul&set zh=7&goto next)
))


:next

for /l %%e in (1 1 !s%m%!) do (
set /a b+=1
if !b! equ 8 set b=1
if %%e lss 10 (set /p= %%e<nul) else (set /p= %%e<nul)
if !fl!==0 (set /a z+=1)

if !z!==7 (echo.&set z=0)
if %%e==!zh! (echo.
set fl=0
)
)
pause>nul


[ Last edited by my3439955 on 2007-4-24 at 12:39 PM ]
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
huzixuan +4 2007-04-26 02:47
Floor 22 Posted 2007-05-04 18:39 ·  中国 山东 潍坊 寿光市 联通
新手上路
Credits 4
Posts 2
Joined 2007-05-04 18:16
19-year member
UID 87470
Gender Male
Status Offline
Floor 23 Posted 2007-05-04 20:51 ·  中国 湖南 邵阳 电信
初级用户
Credits 25
Posts 13
Joined 2007-04-10 04:48
19-year member
UID 84568
Gender Male
Status Offline
Floor 24 Posted 2007-05-14 04:48 ·  中国 江苏 南京 电信
新手上路
Credits 8
Posts 3
Joined 2007-05-14 04:03
19-year member
UID 88455
Gender Male
Status Offline
I just realized now that I'm quite inexperienced
Forum Jump: