Using a technique from tip 1986, I have scripted UnivTime.bat to be a companion
for UnivDate.bat.
The syntax for using UnivTime.bat is:
call UnivTime Hour Minute Second HSecond
Where:
Hour is a call directed environment variable that will contain the 2 digit hour, 00-23. Minute is a call directed environment variable that will contain the 2 digit minute, 00-59. Second is a call directed environment variable that will contain the 2 digit second, 00-59. Hsecond is a call directed environment variable that will contain the 2 digit hundredth of a seconds, 00-99.UnivTime.bat contains:
@echo off setlocal for /f "tokens=5-8 delims=:. " %%a in ('echo.^|time') do ( set thh=%%a&set tmm=%%b&set tss=%%c&set ths=%%d ) if 1%thh% LSS 20 set thh=0%thh% endlocal&set %1=%thh%&set %2=%tmm%&set %3=%tss%&set %4=%ths%
0 comments
Hide comments