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-09-25 01:05
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 请问如何取下个日期时间 How to get the next date and time View 2,465 Replies 20
Floor 16 Posted 2007-04-10 05:15 ·  中国 上海 浦东新区 电信
中级用户
★★
Credits 302
Posts 138
Joined 2007-03-29 02:33
19-year member
UID 83224
Gender Male
Status Offline
Bump myself up a bit, urgently need to solve~~~
Floor 17 Posted 2007-04-10 09:03 ·  中国 广东 广州 联通
银牌会员
★★★
Credits 1,206
Posts 517
Joined 2007-03-25 01:18
19-year member
UID 82819
Gender Male
Status Offline
Hehe, sorry. The code you need is relatively long. I don't have so much time to debug it out.

Do the minimum required.
Know how many days are in each month. (Can be defined)
For February, then judge whether the current year is a leap year (
Then take the current date and then decide whether to add or subtract one day.
Whether the month should be incremented, whether the year should be incremented.
All are within the scope of consideration.
知,不觉多。不知,乃求知
Floor 18 Posted 2007-04-10 09:44 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
21-year member
UID 44210
Status Offline
Originally posted by lililulula at 2007-4-9 14:59:
It's really like that when you mention it. I also looked at the script on floor 2 later and had this problem. My script also has this problem. However, the vbs script on floor 3 is okay. There is a built-in parameter called wekekday~~~~,看来考虑问题没考虑 ...

Next Working Day.vbs
dim Wday,today
today=date
Wday=Weekday(now)
Select Case (Wday)
case 1 today=today+1
case 2 today=today+1
case 3 today=today+1
case 4 today=today+1
case 5 today=today+1
case 6 today=today+3
case 7 today=today+2
end select
WScript.echo CDate(today)

bat
@echo off
for /f "delims=" %%i in ('"cscript //nologo 下一个工作日.vbs"') do echo %%i
pause
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
lililulula +2 2007-04-11 03:00
Floor 19 Posted 2007-04-10 23:37 ·  中国 上海 浦东新区 电信
中级用户
★★
Credits 302
Posts 138
Joined 2007-03-29 02:33
19-year member
UID 83224
Gender Male
Status Offline
Thanks to zh159 for providing the method of getting VBS script variables~~ Thanks a lot, I'll think about implementing it with batch scripts slowly. It seems quite difficult. If any expert knows, please do give advice~~~~~~

[ Last edited by lililulula on 2007-4-10 at 11:09 AM ]
Floor 20 Posted 2007-04-11 00:34 ·  中国 上海 浦东新区 电信
中级用户
★★
Credits 302
Posts 138
Joined 2007-03-29 02:33
19-year member
UID 83224
Gender Male
Status Offline
But there is another problem, can I remove the horizontal line in 2007-04-10 from the retrieved variable? I tried to retrieve it and then use the date variable to remove the horizontal line, but the time returned to the system time. As soon as I use the date function, I don't know how to remove the horizontal line in the VBS script. I hope friends who know can help.
Floor 21 Posted 2007-04-11 03:00 ·  中国 上海 浦东新区 电信
中级用户
★★
Credits 302
Posts 138
Joined 2007-03-29 02:33
19-year member
UID 83224
Gender Male
Status Offline
The problem of the horizontal line has been solved. I didn't think much about it before, but now I've figured it out. Thanks everyone for your help.
Forum Jump: