Advertisement
Infra_HDC

Leading Zeros In A Batch Timestamp

Mar 20th, 2018
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.39 KB | None | 0 0
  1. :prepare time stamp
  2. set year=%date:~10,4%
  3. set month=%date:~4,2%
  4. set day=%date:~7,2%
  5. set hour=%time:~0,2%
  6. :replace leading space with 0 for hours < 10
  7. if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
  8. set minute=%time:~3,2%
  9. set second=%time:~6,2%
  10. set timeStamp=%year%_%month%_%day%_%hour%_%minute%_%second%
  11.  
  12. rem Proof: https://www.ezrasf.com/wplog/2014/01/23/leading-zeros-in-a-batch-timestamp/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement