Leading Zeros In A Batch Timestamp
:prepare time stamp set year=%date:~10,4% set month=%date:~4,2% set day=%date:~7,2% set hour=%time:~0,2% :replace leading space with 0 for hours < 10 if "%hour:~0,1%" == " " set hour=0%hour:~1,1% set minute=%time:~3,2% set second=%time:~6,2% set timeStamp=%year%_%month%_%day%_%hour%_%minute%_%second% rem Proof: https://www.ezrasf.com/wplog/2014/01/23/leading-zeros-in-a-batch-timestamp/
Comments
0 B
|👍
/👎