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-29 08:16
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » (Solved) How to use a command to change the system date to tomorrow! View 795 Replies 2
Original Poster Posted 2005-10-22 12:35 ·  中国 广东 惠州 电信
新手上路
Credits 4
Posts 2
Joined 2005-10-22 12:29
20-year member
UID 43885
Status Offline
Respected experts:
Because of work needs.
I want to use a batch file to change the system date to tomorrow.
But I don't understand it, and I don't even know whether there is such a command.
Please give me some guidance.
My sincere thanks!

[ Last edited by willsort on 2005-10-22 at 21:23 ]
Floor 2 Posted 2005-10-22 14:52 ·  中国 山西 大同 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re 332300684:

At the moment I can think of three approaches:

First, save the system time, then change it to 23:59, pause for one second, and then restore the system time. This method is relatively simple to implement, because it works on most system platforms, but the system time will end up 1 to 2 seconds slow because of it.

Second, convert the system date into the number of days since a certain starting date, add one to the day count, and then convert it back into a system date. Methods for converting between dates and day counts have been mentioned on this forum before, but because arithmetic operations on environment variables are needed, this only applies to NT-series command-line environments.

Third, directly use some third-party tools to calculate the date and then update it. The advantage is that it is simple and fast; the disadvantage is that it cannot be done as a pure batch file operation, so portability will be reduced, and compatibility may also be affected.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 3 Posted 2005-10-22 15:09 ·  中国 广东 惠州 电信
新手上路
Credits 4
Posts 2
Joined 2005-10-22 12:29
20-year member
UID 43885
Status Offline
That really woke me up, this is already enough, thanks
Forum Jump: