By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Done Zero-pad the hour field in @agedate[] for hours < 10

I have a batch file that outputs the NTFS date/timestamps on files, and I noticed that while the year, month, day, minutes and seconds fields all have a leading zero for values less than 10, the hours field does not.
When I run the batch file on a filespec, this messes up the columnar alignment:

12/07/07,13:20:59.794 12/07/07,13:20:59.795 12/07/07,13:21:03.054 speed test.doc
12/07/10,14:22:59.506 12/07/10,14:22:59.506 10/11/01,6:21:00.000 Stephen_King-Survivor_Type.doc

Notice the time in the third column for the Stephen King file. It would be nice if the "6" were output as "06" like the other fields. I know I could write a function that would pull the string apart and put it back together again, but it just seems the leading zero should be in with the other fields.

Thank you!
When I use that function, the hour is always two digits, just as described in the help file. Perhaps there is some difference in your default Windows configuration. Are you using the optional second parameter to specify a format?

I did my tests using an alias with the definition below:

for /l %n in (1,1,6) echo %n %@agedate[%@fileage[%1],%n]​

I ran it on lots of files. Here are some examples of the output:

1 05/22/13,08:44:45.000
4 2013-11-25,00:33:59.132​