Last active
September 23, 2021 17:05
-
-
Save tinytengu/55a9aa32c301632f575491515cbbb88b to your computer and use it in GitHub Desktop.
Fix %time% output (add leading 0, trim ms)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:time_fix | |
set _time=%~1 | |
if "%_time:~0,1%"==" " set %~2=0%_time:~1% | |
if "%_time:~1,1%"==":" set %~2=0%_time% | |
if "%~3"=="1" set %~2=0%_time:~0,7% | |
exit /B 0 | |
rem Usage: CALL :time_fix %time% time_fixed | |
rem echo %time_fixed% | |
rem Usage with trimming: CALL :time_fix %time% time_fixed 1 | |
rem echo %time_fixed% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment