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:

<b>Hour</b>    is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain the 2 digit hour, 00-23.
<b>Minute</b>  is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain the 2 digit minute, 00-59.
<b>Second</b>  is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain the 2 digit second, 00-59.
<b>Hsecond</b> is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> 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%