![]() |
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-08-10 18:48 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » [Share][Original] Post a time calculation one |
| Printable Version 1,826 / 10 |
| Floor1 scriptor | Posted 2007-09-16 15:03 |
| 银牌会员 Posts 555 Credits 1,187 | |
|
There is basically no algorithm to speak of
Pure algebra Also to make up for The deficiencies of that post |
|
| Floor2 lookjcq | Posted 2007-09-16 17:12 |
| 新手上路 Posts 2 Credits 4 | |
| Floor3 danlanse8025 | Posted 2007-09-17 02:16 |
| 新手上路 Posts 5 Credits 9 | |
|
Nice
|
|
| Floor4 uiopuiop | Posted 2007-10-05 12:35 |
| 中级用户 Posts 211 Credits 400 | |
|
Little brother is stupid, how to input a number in seconds, and the output only needs to be accurate to seconds. And the code is in a batch file.
[ Last edited by uiopuiop on 2007-10-5 at 12:52 PM ] |
|
| Floor5 uiopuiop | Posted 2007-10-05 12:57 |
| 中级用户 Posts 211 Credits 400 | |
|
What does "call :clc !h! " mean?
|
|
| Floor6 knoppix7 | Posted 2007-10-05 13:26 |
| 银牌会员 Posts 634 Credits 1,287 From cmd.exe | |
|
Just look at call /? and setlocal /?
|
|
| Floor7 Nickey | Posted 2007-10-05 16:31 |
| 初级用户 Posts 59 Credits 132 From GuangZhou | |
|
@echo off
setlocal enabledelayedexpansion set /p Input=Enter seconds: if %Input% GTR 0 set /a Y=%Input%/31536000&set /a D=(Input%%31536000)/86400&set /a H=(Input%%86400)/3600&set /a M=(Input%%3600)/60&set /a S=Input%%60 echo Equivalent to: %Y% years %D% days %H% hours %M% minutes %S% seconds. pause>nul Overflow will occur if the years exceed |
|
| Floor8 uiopuiop | Posted 2007-10-06 21:44 |
| 中级用户 Posts 211 Credits 400 | |
|
@echo off
setlocal enabledelayedexpansion set /p Input=Enter seconds: if %Input% GTR 0 set /a Y=%Input%/604800&set /a D=(Input%%604800)/86400&set /a H=(Input%%86400)/3600&set /a M= (Input%%3600)/60&set /a S=Input%%60 echo Equivalent to: %Y% weeks %D% days %H% hours %M% minutes %S% seconds. pause>nul [ Last edited by uiopuiop on 2007-10-6 at 11:29 PM ] |
|
| Floor9 gne | Posted 2007-12-31 20:15 |
| 初级用户 Posts 45 Credits 77 | |
| Floor10 knoppix7 | Posted 2007-12-31 21:20 |
| 银牌会员 Posts 634 Credits 1,287 From cmd.exe | |
|
:: Func: Returns a calendar date and time of day from the number of
:: elapsed seconds since 1st January 1970 00:00:00. For :: NT4/2000/XP/2003. :: :: Args: %1 seconds used to create calendar date and time of day :: %2 var to receive year, 4 digits for all typical dates :: %3 var to receive month, 2 digits, 01 to 12 :: %4 var to receive day of month, 2 digits, 01 to 31 :: %5 var to receive hours, 2 digits, 00 to 23 :: %6 var to receive minutes, 2 digits, 00 to 59 :: %7 var to receive seconds, 2 digits, 00 to 59 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @echo off set /a i=%1,ss=i%%60,i/=60,nn=i%%60,i/=60,hh=i%%24,dd=i/24,i/=24 set /a a=i+2472632,b=4*a+3,b/=146097,c=-b*146097,c/=4,c+=a set /a d=4*c+3,d/=1461,e=-1461*d,e/=4,e+=c,m=5*e+2,m/=153,dd=153*m+2,dd/=5 set /a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3,yy=b*100+d-4800+m/10 (if %mm% LSS 10 set mm=0%mm%)&(if %dd% LSS 10 set dd=0%dd%) (if %hh% LSS 10 set hh=0%hh%)&(if %nn% LSS 10 set nn=0%nn%) if %ss% LSS 10 set ss=0%ss% endlocal&set %7=%ss%&set %6=%nn%&set %5=%hh%&^ set %4=%dd%&set %3=%mm%&set %2=%yy%&goto :EOF |
|
| Floor11 plp626 | Posted 2008-03-03 21:44 |
| 银牌会员 Posts 1,020 Credits 2,278 | |
|
Study together:
http://www.cn-dos.net/forum/viewthread.php?tid=37382&page=1### --------------->15th floor |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |