Welcome!

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

SignUp Now!

Leading Zeroes in variables

Status
Not open for further replies.
Jul
23
0
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
 
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.
Back
Top