Randy Johnson
asked on
Script Time Question Leading 0
Hello,
SET t1=%TIME:~0,2%
SET t2=%TIME:~3,2%
SET t3=%TIME:~6,4%
SET g1=%DATE:~4,2%
SET g2=%DATE:~7,2%
SET g3=%DATE:~10,4%
I use the above to get the time into chunks.
and them in a file.
move myFile.txt myFile-%g1%_%g2%_%g3%-%t1% _%t2%_%t3% .txt
It works fine as long as there is a 2 digit hour such as 10 11 or 12
If it is 7AM how can I get the hour above to have a leading 0? such as 07 instead of just 7
T1 above is what holds the hour.
Thanks!
Randy
SET t1=%TIME:~0,2%
SET t2=%TIME:~3,2%
SET t3=%TIME:~6,4%
SET g1=%DATE:~4,2%
SET g2=%DATE:~7,2%
SET g3=%DATE:~10,4%
I use the above to get the time into chunks.
and them in a file.
move myFile.txt myFile-%g1%_%g2%_%g3%-%t1%
It works fine as long as there is a 2 digit hour such as 10 11 or 12
If it is 7AM how can I get the hour above to have a leading 0? such as 07 instead of just 7
T1 above is what holds the hour.
Thanks!
Randy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER