Welcome!

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

SignUp Now!

Re: Leading Zeroes in variables

May
3,515
5
From: gadib
| 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?


While you were already shown verbose solutions, the simplest is available
using the _DATETIME internal variable, which has the value of date and time
to the second:

%@right[-2,%_datetime].tgz

BTW, I tried to send this originally as a response to the original message,
but it was rejected by the Forum with the message "thread already closed".
What caused closing of the original thread closed?
--
HTH, Steve
 
While you were already shown verbose solutions, the simplest is available
using the _DATETIME internal variable, which has the value of date and time
to the second:

%@right[-2,%_datetime].tgz

I was going to suggest %@replace[-,,%_isodate] (before I too found the thread 'closed'), but I like your idea much better.
 
From: gadib
| i would like to create a variable that has the format yyyymmddhhmm.tgz

%@right[-2,%_datetime].tgz

It should be %@left[-2,%_datetime].tgz

@right returns yymmddhhmmss
@left returns yyyymmddhhmm
 
From: JohnQSmith
| Originally Posted by Steve Fabian
|| From: gadib
||| i would like to create a variable that has the format
||| yyyymmddhhmm.tgz
||
|| %@right[-2,%_datetime].tgz
|
| It should be %@left[-2,%_datetime].tgz
|
| @right returns yymmddhhmmss
| @left returns yyyymmddhhmm

You are correct, I goofed!
--
Steve
 
Back
Top