@Echo off SETLOCAL : This duplicates the functionality of %time% with one difference that : it has a hard-coded time separator of : : this makes it usable for any user with any regional settings : The two default formats for TIME are h:mm:ss.th and h:mm:ss,th : however users can change this in the control panel :: Get the time separator FOR /F "TOKENS=3" %%D IN ('REG QUERY ^"HKEY_CURRENT_USER\Control Panel\International^" /v sTime ^| Find ^"REG_SZ^"') DO (Set _time_sep=%%D) FOR /f "tokens=1,2,3 delims=:.%_time_sep%" %%G IN ("%time%") DO ( Set "_hr=%%G" Set "_min=%%H" Set "_sec=%%I" ) ::strip any leading spaces Set _hr=%_hr: =% ::ensure the hours have a leading zero if 1%_hr% LSS 20 Set _hr=0%_hr% Echo The time is: %_hr%:%_min%:%_sec% ENDLOCAL&Set _time=%_hr%:%_min% :: https://windevcluster.com/nt/time.html