1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Leading Zeroes in variables

Discussion in 'TCC/LE Support' started by gadib, May 15, 2011.

Thread Status:
Not open for further replies.
  1. gadib

    Joined:
    Jul 23, 2008
    Messages:
    22
    Likes Received:
    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
     
  2. Kachupp

    Joined:
    Aug 9, 2009
    Messages:
    133
    Likes Received:
    0
    Read the help file %@format[04,5]


     
  3. mathewsdw

    Joined:
    May 24, 2010
    Messages:
    855
    Likes Received:
    0
    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.
     
  4. gadib

    Joined:
    Jul 23, 2008
    Messages:
    22
    Likes Received:
    0
    Thanks for your help.
    Worked like a charm.

    Gadi
     
Thread Status:
Not open for further replies.

Share This Page