Leading Zeroes in variables

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Status
Not open for further replies.
#1
Hi,

i would like to create a variable that has the format yyyymmddhhmm.tgz
I tried set fn=%_year%%_month%%_day%%_hour%%_minute%.tgz

The variable resolves to 2011515917.tgz
How do I get TCC/LE it to insert leading zeroes in the variables?

Gadi
 
#3
Hi,

i would like to create a variable that has the format yyyymmddhhmm.tgz
I tried set fn=%_year%%_month%%_day%%_hour%%_minute%.tgz

The variable resolves to 2011515917.tgz
How do I get TCC/LE it to insert leading zeroes in the variables?

Gadi
It's a bit more typing but other than that relatively easy. Specifically, the statement should read:

set fn=%_year%%@Right[2,0%_month]%@Right[2,0%_day]%@Right[2,0%_hour]%@Right[2,0%_minute%].
tgz

And that's all there is to it! (I'll add, just to make sure that there is no confusion, that the "set ", the "fn=..." and the "tgz" are all on one line, they are on separate adjacent lines in the above because of the limitation of maximum line length of the display in this bulletin board.)

You can also similarly use the @Format function if you prefer.
 
Status
Not open for further replies.