![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-11-10 12:39 |
47,815 topics / 349,930 posts / today 0 new / 48,291 members |
| DOS批处理 & 脚本技术(批处理室) » Batch version perpetual calendar |
| Printable Version 18,220 / 44 |
| Floor16 Michael | Posted 2007-06-03 11:16 |
| 钻石会员 Posts 3,041 Credits 10,056 | |
Originally posted by qzwqzw at 2007-5-27 06:14 PM: The only way is to teach the "fool" from your hometown to learn batch files. Hehe. |
|
| Floor17 namejm | Posted 2007-06-03 13:32 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Posting a version that's a bit more convenient to use. I removed the extra blank lines in the calendar, and fixed the error in the code on the 15th floor where querying July 2007 showed only 30 days. This error was caused by the 1st of that month happening to be Sunday, while 37 loops could only scan up to the 30th. For more changes, see the code comments.
[ Last edited by namejm on 2007-6-3 at 02:50 PM ] |
|
| Floor18 qzwqzw | Posted 2007-06-03 14:25 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
I noticed the July 2007 problem
but by then I didn't have time to change it anymore ---------------------------------- Removing blank lines will make the prompt information and the date input position change frequently That does not have a positive effect on the layout So I didn't consider it ---------------------------------- The changes in the date formatting and validation part are rather messy If you input 7-6-3 you get 7-06-03 (the year is not formatted) If you input 0 you get 2007-00-01 (the month is not validated) The original default values for month and day were October / 10th just because that was simpler to implement ---------------------------------- As for displaying "that day" / "today" I now feel it doesn't mean much especially when compared with %date% that already includes the weekday [ Last edited by qzwqzw on 2007-6-3 at 02:33 PM ] |
|
| Floor19 namejm | Posted 2007-06-03 14:57 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
Originally posted by qzwqzw at 2007-6-3 14:25: I want to make this code into a perpetual calendar, and 7 means AD 7, so it can't be formatted. If you input 0 you get 2007-00-01 (the month is not validated) The code on the 17th floor already added detection for dates and months being 0. As for displaying "that day" / "today" When running into a %date% format that includes the weekday, it really is quite a headache, and the date extraction code is hard to make fully compatible. Also, the date separator can be specified manually, which makes compatibility even harder. |
|
| Floor20 qzwqzw | Posted 2007-06-03 15:36 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
As I already said, a perpetual calendar doesn't mean much
Who is going to look up the weekday of year 1 AD? Back then there wasn't even the Gregorian calendar If you really want to make a professional chronology then you need to consider BC as well Who knows whether this formula is still applicable in BC And your code has already added a 0~55 judgment That means you are also defaulting 0~55 to +2000 ---------------------------------------------------- After simplifying the date formatting and validation code, it is as follows [ Last edited by qzwqzw on 2007-8-5 at 06:48 PM ] |
|
| Floor21 namejm | Posted 2007-06-03 16:10 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
Originally posted by qzwqzw at 2007-6-3 15:36: Hehe, a perpetual calendar really doesn't mean much. I'll just treat it as a game to make ^_^.
Actually, in my code I added a judgment for 00~55, not 0~55, so if you want the script to automatically add the 19 or 20 prefix, you need to enter a two-digit year. The code on the 20th floor fully takes into account people's reading and query habits, and also formats the date, so it is already very complete. It's just that the explanation about the year conversion part was copied directly from my code, so the described effect does not completely match your code's function. I suggest changing it to this: :: About year conversion: |
|
| Floor22 qzwqzw | Posted 2007-06-03 22:16 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Thanks for pointing it out
Already fixed |
|
| Floor23 zjl5 | Posted 2007-06-16 03:05 |
| 初级用户 Posts 15 Credits 82 | |
|
Still can't find a way to calculate the lunar calendar, can only calculate the zodiac and the Heavenly Stem/Earthly Branch year.
|
|
| Floor24 whswbiori | Posted 2007-08-01 05:00 |
| 新手上路 Posts 5 Credits 10 | |
|
Such a great atmosphere, you two are really active. I've looked through 3 or 4 posts and you're both in all of them
|
|
| Floor25 kidzgy | Posted 2007-08-01 09:17 |
| 中级用户 Posts 129 Credits 262 | |
|
So which one is the most perfect in the end?
|
|
| Floor26 kidzgy | Posted 2007-08-01 09:21 |
| 中级用户 Posts 129 Credits 262 | |
|
The one on the 20th floor: if the date input is wrong, it goes into an infinite loop. It's always an error.
|
|
| Floor27 qzwqzw | Posted 2007-08-01 10:15 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
Please be more specific
What kind of wrong date did you enter? Where does it go into an infinite loop? |
|
| Floor28 youxi01 | Posted 2007-08-01 12:33 |
| 高级用户 Posts 247 Credits 846 From 湖南==》广东 | |
|
Brother namejm and brother qzwqzw are still this enthusiastic, admirable ing
|
|
| Floor29 kidzgy | Posted 2007-08-01 18:04 |
| 中级用户 Posts 129 Credits 262 | |
Originally posted by qzwqzw at 2007-8-1 10:15 AM: I copied your code into a bat file. No matter what I enter, letters or the format you gave, even 07-02-03 doesn't work. After pressing Enter it says there's an error. At that point, pressing any key won't return to the main menu, causing an infinite loop, and it just stays on the error screen unless you close it. |
|
| Floor30 qzwqzw | Posted 2007-08-01 18:36 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
I can't reproduce your error
If you know some simple batch debugging techniques you can insert a statement before the error prompt in the code to check the results of the variable input at that moment echo [%OS%][%date%][%sDate%][%y%=%m%=%d%] |
|
| Prev 1 2 3 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |