Re: Leading Zeroes in variables

#1
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
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,602
46
Albuquerque, NM
prospero.unm.edu
#2
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.
 
#4
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