Advertisement
Cogger

Date_today.cmd

Jan 17th, 2022
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.54 KB | None | 0 0
  1. @ECHO OFF
  2. : Sets the proper date and time stamp with 24Hr Time for log file naming
  3. : convention ('YYYYMMDD_HHMMSS')
  4.  
  5. : Scrapes the characters out of their expected permissions in the date/time
  6. : environment variables.
  7.  
  8. : Expects a date format of '____MM_DD_YYYY'
  9. : Expects a time format of 'HH:MM:SS' or ' H:MM:SS'
  10.  
  11. SET HOUR=%time:~0,2%
  12. SET dtStamp9=%date:~-4%%date:~4,2%%date:~7,2%
  13. SET dtStamp24=%date:~-4%%date:~4,2%%date:~7,2%
  14.  
  15. if "%HOUR:~0,1%" == " " (SET dtStamp=%dtStamp9%) else (SET dtStamp=%dtStamp24%)
  16.  
  17. echo %dtStamp%| clip
  18.  
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement